当前位置: 首页 > 图文教程 > Flash动画 > ActionScript > Flash AS实例:制作切换菜单动画

ActionScript
ActionScript3教程:语句实例
ActionScipt技巧和开发中会遇到的问题
Flash as3.0教程:弹性小球
flash as简单制作飘雪动画
Flash AS 教程:交互动画
Flash ActionScript 3.0教程:学习Dot类
Flash AS 教程:子类化显示对象
Flash AS 教程:动画事件
Flash AS 教程:创建文档类(Document class)
Flash AS 教程:帧循环
Flash AS 教程:类和面向对象编程
Flash AS 教程:构造函数(Constructor)
Flex程序开发心得小结
Flash游戏开发教程:第一节
FLASH中的元件能在Flex中完美使用
关于XML在FLASH中的应用
Flash AS教程:decorator Pattern
Flash AS实例教程:简单的loading
Flash教程:彻底学习RadioButton组件
Flash AS教程:复制粘贴类

ActionScript 中的 Flash AS实例:制作切换菜单动画


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-30   浏览: 76 ::
收藏到网摘: n/a

先看看效果:


详细代码:


//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;

}

};

}

};

}
源文件附件:切换菜单.rar