0
How can I make this eye animation in Flash loop continuously after removing Event Listener?
Community Beginner
,
/t5/animate-discussions/how-can-i-make-this-eye-animation-in-flash-loop-continuously-after-removing-event-listener/td-p/9798372
Mar 16, 2018
Mar 16, 2018
Copy link to clipboard
Copied
I have made a movieclip of an eye, which is set to play a blinking animation at random intervals. I have multiple instances on the stage, and when I play it, there's maybe 1-2 seconds of blinking and then it stops completely. How can I make it loop?
I had to add the removeEventListener at the end because Flash would crash if I didn't, I think because it was infinitely loading the function or something.
The code is placed inside the eye movie clip.
this.gotoAndStop(1); var eye:Eye = new Eye(); var eyeTimer = new Timer(1000 + Math.random() * 1000); eyeTimer.addEventListener(TimerEvent.TIMER, blink); eyeTimer.start(); function blink(evt:TimerEvent��void { Timer(evt.currentTarget).delay = 1000 + Math.random() * 1000; trace( "triggered!" ); this.gotoAndPlay(1); eyeTimer.removeEventListener(TimerEvent.TIMER, blink); }
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/animate-discussions/how-can-i-make-this-eye-animation-in-flash-loop-continuously-after-removing-event-listener/m-p/9798373#M179426
Mar 17, 2018
Mar 17, 2018
Copy link to clipboard
Copied
don't remove the eventlistener.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more