最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
仿苹果电脑的导航菜单
时间:2022-07-02 17:18:23 编辑:袖梨 来源:一聚教程网
06年学类时,写的菜单效果。模仿苹果机中的菜单效果,鼠标经过图标时,以该图标为中心向两边缩放。 attachMc(scale);
resetPosition();
}
//加载图片
private function attachMc(scale:Number):Void {
for (var i:Number = 0; i
mouseControlZoomEffect(menu, scale);
menu.onRollOver = function() {
//trace(this._name);
};
}
}
//鼠标控制缩放比例效果
private function mouseControlZoomEffect(mc:MovieClip, scale:Number):Void {
var owner:Object = this;//用一个临时变量指向当前类
mc.onEnterFrame = function() {
var mouseX:Number = Math.abs(this._x+this._width/2+owner.imageContainer._x-owner.imageContainer._parent._xmouse);
//trace(mc._name+">>> "+mouseX);trace("");
if (owner.imageContainer.hitTest(owner.target._xmouse, owner.target._ymouse)) {
if (mouseX
owner.zoomEffect(this, num);
} else {
owner.zoomEffect(this, 100);
}
} else {
owner.zoomEffect(this, 100);
}
updateAfterEvent();
};
}
//缩放效果
private function zoomEffect(mc:MovieClip, scale:Number):Void {
var ratio:Number = .4;
mc._xscale = mc._yscale += (scale-mc._xscale)*ratio;
}
//重新设置各菜单的位置
private function resetPosition():Void {
var owner:Object = this;
target.onEnterFrame = function() {
for (var i:Number = 0; i
menu._x = owner.imageContainer["menu"+(i-1)]._x+owner.imageContainer["menu"+(i-1)]._width+owner.spanX;
menu._y = owner.ypos-menu._height;
owner.imageContainer._x = (Stage.width-owner.imageContainer._width)/2;
}
updateAfterEvent();
};
}
//转义(位置、间距等)
public function get _ypos():Number {
return this.ypos;
}
public function set _ypos(values:Number):Void {
this.ypos = values;
}
public function get _spanX():Number {
return this.spanX;
}
public function set _spanX(values:Number):Void {
this.spanX = values;
}
public function get _x():Number {
return this.target._x;
}
public function set _x(values:Number):Void {
this.target._x = values;
}
public function get _y():Number {
return this.target._y;
}
public function set _y(values:Number):Void {
this.target._y = values;
}
}
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22