当前位置:软件学习 > Flash >>

AS2.0 制作切换菜单效果

AS2.0 制作切换菜单效果
var 设置 = {};

设置.数量 = 10;

设置.间距 = 150;

设置.比例 = 250;

设置.速度 = 4;

//////////////////////////////////////////////

var 中心MC = 0;

var 按 = false;

var 转 = false;

var H = Stage.height/2;

var W = Stage.width/2;

for (var i = 0; i<设置.数量+1; i++) {

var MC_mc = this.attachMovie("mc", "mc_"+this.getNextHighestDepth(), this.getNextHighestDepth());

if (i<设置.数量) {

MC_mc.txt.text = i+1;

MC_mc.hd = Math.PI*2/设置.数量*i;

MC_mc._x = W+Math.sin(MC_mc.hd)*设置.间距;

MC_mc._y = H+Math.cos(MC_mc.hd)*设置.间距;

} else {

MC_mc.txt.text = i+1;

MC_mc._x = W;

MC_mc._y = H;

MC_mc._xscale = 设置.比例;

MC_mc._yscale = 设置.比例;

中心MC = MC_mc;

}

MC_mc.onPress = function() {

if (中心MC != this && 按 == false) {

按 = true;

var ox = this._x;

var oy = this._y;

this.swapDepths(_root.getNextHighestDepth());

this.onEnterFrame = function() {

this._x += (W-this._x)/设置.速度;

this._y += (H-this._y)/设置.速度;

this._xscale += (设置.比例-this._xscale)/设置.速度;

this._yscale += (设置.比例-this._yscale)/设置.速度;

中心MC._x += (ox-中心MC._x)/设置.速度;

中心MC._y += (oy-中心MC._y)/设置.速度;

中心MC._xscale += (100-中心MC._xscale)/设置.速度;

中心MC._yscale += (100-中心MC._yscale)/设置.速度;

if (Math.abs(中心MC._x-ox) >> 0<=1 && Math.abs(中心MC._y-oy) >> 0<=1) {

中心MC._x = ox;

中心MC._y = oy;

this._x = W;

this._y = H;

中心MC = this;

按 = false;

delete this.onEnterFrame;

}

};

}

};

}

补充:flash教程,动画技术
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,