Posted on 2009-02-21
I have created a class part of which displays an animated gif image in the calling scripts html page, at the same time a sound is streamed from a serever. This is done as follows:
this.img1Id.src = this.animatedDice;
startStream (this.diceSound, this.flashProxy);
this part of the code works correctly. Now I need to pause for 2 seconds so the sound has time to finish playing then the animated gif is replaced using the following line of code:
This line of code also works correctly but how can I pause between the first 2 lines and the last line of code? This is important so that the class does not return before the sound is finished. I have tried using the timeout function but the class exits before the timer is finished.
As the code stands the animated gif is replaced immediately by the final image (the last line of code).