ǰλ: ҳ > ҳ > Flash̳ > 随机运动效果

随机运动效果

ߣguanchaofeng Դ ʱ䣺 2009-03-24 18:51 :
效果?BR> /design/UploadPic/2009-3/2009324185128198.swf main?/FONT> package { import flash.display.MovieClip; import flash.events.Event; public class main extends MovieClip { public function main() { } public function hs(_mc:MovieClip

随机运动效果

效果?BR>/design/uploads/allimg/2009-3/2009324185128198.swf

main?/FONT>

package {
 import flash.display.MovieClip;
 import flash.events.Event;
 public class main extends MovieClip {
  public function main() {
  }
  public function hs(_mc:MovieClip) {
   var dx:int=10;
   var dy:int=10;
   var jiaodu:Number=Math.random()*(2*Math.PI);
   _mc.addEventListener(flash.events.Event.ENTER_FRAME,enter_f);
   function enter_f(e:Event) {
    e.target.x+=Math.cos(jiaodu)*dx;
    e.target.y+=Math.sin(jiaodu)*dy;
    if (e.target.x+e.target.width>stage.stageWidth) {
     dx*=-1;
     e.target.x-=10;
    }
    if (e.target.x<0) {
     dx*=-1;
     e.target.x+=10;
    }
    if (e.target.y+e.target.height>stage.stageHeight) {
     dy*=-1;
     e.target.y-=10;
    }
    if (e.target.y<0) {
     dy*=-1;
     e.target.y+=10;
    }
   }
  }
 }
}

//

var _mc:mc;
for(var i:uint;i<10;i++){
 _mc=new mc();
 _mc.x=stage.stageWidth*Math.random();
 _mc.y=stage.stageHeight*Math.random();
 addChild(_mc);
 hs(_mc);
 }

附件?/FONT>随机移动.rar

"随机运动效果"Զվռѧϰοʹáվ̳Զվվ
һ
(0)
0%
һ
(0)
0%
[ ] [һҳ] [ӡ]
Ծػص߷棬Ͻɫ顢ۡ
:
:
û: : ֤:
ڱվ - ϵ - վ - - վͼ - վͼ - ض
Copyright © 2007-2013 www.yhzhan.com(Զվ). All Rights Reserved .
Զվ:ΪСվṩѵѧϰ뽻ƽ̨,ṩҳվ̵ȸվ̳.
ٷQQ:445490277 վȺ:26680406 վ:ԥICP07500620-4