开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜