package AS { import flash.events.TimerEvent; import flash.utils.Timer; import mx.controls.Image; public class image_Change extends Image { private var delay:uint=2000; private var repeat:uint=3; private var myTimer:Timer=new Timer(delay,repeat); public function image_Change() { source="resource/images/"+repeat+".jpg"; myTimer.start(); myTimer.addEventListener(TimerEvent.TIMER,timerHandler); myTimer.addEventListener(TimerEvent.TIMER_COMPLETE,timer_reset); } public function timerHandler(event:TimerEvent):void{//第次延时后执行 repeat--; if(repeat==0)repeat=3; this.source="resource/images/"+repeat+".jpg"; } public function timer_reset(event:TimerEvent):void{//转一圈后再转回来 myTimer.start(); } } }
as延时
最新推荐文章于 2022-09-21 00:21:42 发布