Flash AS特效:超绚丽的闪字动画
代码如下:
/*作者:梦自在*/
importmx.transitions.*;
importmx.transitions.easing.*;
varr:number=45;
varp:number=0;
vardrag:boolean=false;
varnum:number=0;
varname_array:array=newarray("闪","吧","2","0","0","8","兴","旺","发","展");
this.createemptymovieclip("container",this.getnexthighestdepth());
/*旋转*/
functionstart_func(){
for(vari:number=0;i<=9;i ){
container.attachmovie("ball","ball" i,i);
container["ball" i]._x=225 r*(math.abs(4.5-i))*math.cos((135-(math.floor((i/5))*180))*math.pi/180);
container["ball" i]._y=225 r*(math.abs(4.5-i))*math.sin((135-(math.floor((i/5))*180))*math.pi/180);
container["ball" i].txt.text=name_array[i];
container["ball" i].i=i;
container["ball" i].onenterframe=function(){
varmy_color:color=newcolor(this._mc);
my_color.setrgb(math.random()*0xffffff);
this._x=225 r*(math.abs(4.5-this.i))*math.cos(((135-(math.floor((this.i/5))*180)) p)*math.pi/180);
this._y=225 r*(math.abs(4.5-this.i))*math.sin(((135-(math.floor((this.i/5))*180)) p)*math.pi/180);
p=p 0.5;
};
container["ball" i].onpress=function(){
varmytween:tween=newtween(this,"_xscale",elastic.easeout,100,200,1,true);
varmytween:tween=newtween(this,"_yscale",elastic.easeout,100,200,1,true);
};
container["ball" i].onrelease=function(){
varmytween:tween=newtween(this,"_xscale",elastic.easeout,200,100,1,true);
varmytween:tween=newtween(this,"_yscale",elastic.easeout,200,100,1,true);
};
}
}
start_func();
/*拖动跟随*/
varmouselistener:object=newobject();
mouselistener.onmousedown=function(){
if(container["ball" 0].hittest(_root._xmouse,_root._ymouse)){
drag=true;
}
};
mouselistener.onmousemove=function(){
if(drag){
num=1;
deletecontainer["ball" 0].onenterframe;
container["ball" 0]._x=_root._xmouse;
container["ball" 0]._y=_root._ymouse;
for(vari:number=1;i<=9;i ){
deletecontainer["ball" i].onenterframe;
container["ball" i]._x =(container["ball" (i-1)]._x-container["ball" i]._x)/3;
container["ball" i]._y =(container["ball" (i-1)]._y-container["ball" i]._y)/3;
}
}
};
mouselistener.onmouseup=function(){
drag=false;
/*拖动后才能恢复*/
if(num==1){
start_func();
num=0;
}
};
mouse.addlistener(mouselistener);
源文件:闪吧2008兴旺发展.rar