|
 
- 帖子
- 603
- 积分
- 191
- 技术分
- 34
- 在线时间
- 853 小时
- 注册时间
- 2004-2-21
|
1#
发表于 2010-1-11 21:01
| 只看该作者
切换菜单效果(附源文件)
本帖最后由 原始人 于 2010-1-11 21:18 编辑
闪友发来个效果``试着做````大概做出来了```原版`没在我电脑这``先发我做的吧!!
切换菜单.fla (47.5 KB)
切换菜单.swf (1.16 KB)
直接上代码- //AS2.0/////////QQ:31559783////////2010.01.11///////////////////////////////
- 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;
- }
- };
- }
- };
- }
复制代码 |
|