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 want to place many instances of that movieclip on the stage, where they're all being played at different times. But if I put multiple instances of the clip on the stage, only one will play. How do I have many instances playing at the same time?
I haven't used flash for years so please explain simply if you can~
stop(); 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!" ); eye.gotoAndPlay(1);
}
Copy link to clipboard
Copied
did you give a different name to each mc?
Copy link to clipboard
Copied
Hi.
I myself would rather prefer to put a simple randomization code inside of a container Movie Clip containing two eyes -- considering that they have to blink at the same time.
In this way, you'll won't have a headache trying to reference each Miovie Clip in different frames, nested in different timelines, using tweening, and so on.
Preview:
Code:
gotoAndPlay(Math.ceil(Math.random() * 150));
FLA download:
animate_cc_as3_random_blink.zip - Google Drive
Regards,
JC
Copy link to clipboard
Copied
Would love to download the assets but the link doesn't work. Also I'm animating individual eyes, not connected to each other.
Copy link to clipboard
Copied
I'm really sorry about the link!
That's the second time this week that Googgle blocks a link of mine.
Anyway, I edited my comment with a valid link this time! I hope it can be helpful.
Copy link to clipboard
Copied
cries quietly bc i've been at this all day and your suggestion really got me closer than anything else, thank you so much, i appreciate it so much !!!
Copy link to clipboard
Copied
Excellent! You're welcome!