请问FLASH怎么写命令让鼠标经过放大图片时都在最上层?不被遮着新手请...
发布网友
发布时间:2024-10-23 22:59
我来回答
共1个回答
热心网友
时间:2024-11-06 02:21
在帧上加上动作(AS2):
for (i=1; i<=4; i++) {//假定有4张图片,所有图片转换为影片剪辑
_root["mc"+i].onRollOver = function() {
ww = this._width*3;//这里如果知道图片具体宽度,就将this._width换成具体数字再乘以3
hh = this._height*3;//同上,this._height为高度
if (this._width<ww || this._height<hh) {//图片放大为3倍
this.onEnterFrame = function() {
this._width += (ww-this._width)/4;
this._height += (hh-this._height)/4;
};
} else {
delete this.onEnterFrame;
}
this.swapDepths(10);//图片转到最上层
};
_root["mc"+i].onRollOut = function() {
ww1 = this._width/3;//这里可直接写成ww1等于图片宽度,this._width/3就是图片原宽度
hh1 = this._height/3;
if (this._width>ww1 || this._height>hh1) {//图片缩小到原大小
this.onEnterFrame = function() {
this._width -= (this._width-ww1)/4;
this._height -= (this._height-hh1)/4;
};
} else {
delete this.onEnterFrame;
}
this.swapDepths(1);//图片转到最下层
}
}