• WAP手机版 加入收藏  设为首页
实例教程

Flash制作伪3D旋转菜单

时间:2016-10-19 9:38:07   作者:yiming   来源:Flash中国园地网   阅读:774   评论:0

效果预览:

 

 

代码:

import flash.geom.Point;

var total:Number = 11;

var center:Point = new Point(Stage.width/2, Stage.height/2);

var rx:Number = 180;

var ry:Number = 80;

var step:Number = 0;

var entity:MovieClip = _root.createEmptyMovieClip("entity", 10);

for (var i:Number = 0; i

var image:MovieClip = entity.attachMovie("image1", "image"+i, i);

image.txt.text = i;

align(0);

rotate(image);

}

function rotate(mc:MovieClip):Void {

mc.onPress = function() {

if (_root._xmouse-center.x>0) {

var num:Number = 5;

} else {

var num:Number = -5;

}

this.onEnterFrame = function() {

align(num);

if (num>0 && this._x

delete this.onEnterFrame;

} else if (num<0 && this._x>center.x) {

delete this.onEnterFrame;

}

};

};

}

function align(num):Void {

var radian:Number = Math.PI/180;

for (var i:Number = 0; i

var image:MovieClip = entity["image"+i];

var angle:Number = 90+360/total*i;

image._x = center.x+rx*Math.cos((angle+step)*radian);

image._y = center.y+ry*Math.sin((angle+step)*radian);

image._alpha = image._y-115;

image._xscale = image._yscale=(image._y-70)*.5;

image.swapDepths(image._y);

}

step += num;

updateAfterEvent();

 


标签:Flash 制作 3D 旋转 菜单 
相关评论

皖ICP备11010134号——百度统计——会员管理规则——免责声明——网站地图——xml地图——联系我们