PDA

View Full Version : I know it's been asked a lot but is setInterval all it's cracked up to be?



darthmahon
December 6th, 2004, 07:38 AM
Hi,

Ok I'm not quite sure if there is a better way to delay actions in flash but it seems that setInterval is the best way...unfortunately this does not work properly in my opinion, I am having nothing but problems with it...

Have a look at the attached fla, only 6kb in size...now, run index.swf and click on the black circle - there should be a 1 second delay between Frame 1, Frame 2, Frame 3 and Frame 4 - the words come up...

This works fine the first time you press the black button, however, try clicking the button very quickly in succession one after the other...notice how the movie skips certain frames? Why on earth is it doing this? I have tried everything to rectify this but I just can't get my head around this! Does anyone have a solution?

Cheers,
Chris

Smee
December 6th, 2004, 08:41 AM
The problem is that when you load the movie, it is being loaded into level1, whereas the button is in level0. Change the clearInterval on the button to:

clearInterval(_level1.my_interval);

It should work then.

darthmahon
December 6th, 2004, 09:42 AM
Smee thank you very much, you have made my life much easier!!! I should have realised I needed to refer to level1, it didn't even occur to me! Doh!