flash 8 + setTimeout problem
I have to hand off a Flash file to a client that use Flash 8, so I am using ActionScript 2 here. I am trying to create a firework effect that consist five fireballs (all instances of the same movieclip) that explode at different time using setTimeout. Here is the code:
setTimeout( playFirework(fireball1), 350开发者_运维技巧0 ); setTimeout( playFirework(fireball2), 4500 ); setTimeout( playFirework(fireball3), 4500 ); setTimeout( playFirework(fireball4), 5500 ); setTimeout( playFirework(fireball5), 5500 ); function playFirework(mcFirework){ mcFirework.gotoAndPlay("start") }
The delay doesn't seen to be happening. All fireballs start at the same time. Any idea?
The syntax is
setTimeout( callback, delay, argument)
So you want
setTimeout(playFirework, 3500, fireball1);
http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000602.html
精彩评论