playing with setInterval and clearInterval
Hi all,
One more example on setInterval in action script 3.0, i found when i was playing with timing events of as3.0.
Expect, following code will be helpful:
Just create a movieclip on the stage and put its instance name my_btn and copy the following code and paste it on first frame of your flash file:
function moveBtn():void {
my_btn.x+=10;
}
var myInterval:uint=setInterval(moveBtn,500);
my_btn.addEventListener(MouseEvent.MOUSE_DOWN, stopMe);
my_btn.addEventListener(MouseEvent.MOUSE_UP, playMe);
function stopMe(e:MouseEvent):void {
clearInterval(myInterval);
}
function playMe(e:MouseEvent):void {
myInterval =setInterval(moveBtn,500);
}
Thanks,
Ravi Bhadauria
ADMEC Multimedia Institute
#32035055
|