Associate
- Joined
- 21 Sep 2007
- Posts
- 453
I am having some very odd issues with a randomly rotating image banner.
The setup is very basic. 6 key frames, the first being empty and the next 5 populated with one movie clip per frame.
Code on the first frame:
Code:
This generates a random number ranging from and including 2 to 6 (the frames containing the clips)
Then, frames 2-6 have a stop(); command on them.
Lastly, inside the movie clips, there is a play(); command on the first frame and on the very last frame of each, I have this code:
Code:
Now, heres the kicker. Often, the flash works fine, although it does like to favour frames 2, 3 and 5. Other times, on executing the swf, the randomly chosen clip fails to play, despite the play(); command.
Using the trace, I noticed it was trying to load and play frame 4, yet when I right clicked the flash and told it to play, the clip to load was the clip from frame 5!
I doubled checked all the code, and there is nothing out of place, all syntax is correct and i have used the same numbers in all the random generation code.
Can anybody shed some light on this very odd problem?
Thankyou!
The setup is very basic. 6 key frames, the first being empty and the next 5 populated with one movie clip per frame.
Code on the first frame:
Code:
Code:
rand = Math.floor(Math.random() * (7-2)) + 2;
gotoAndPlay(rand);
trace(rand);
This generates a random number ranging from and including 2 to 6 (the frames containing the clips)
Then, frames 2-6 have a stop(); command on them.
Lastly, inside the movie clips, there is a play(); command on the first frame and on the very last frame of each, I have this code:
Code:
Code:
a=Math.floor(Math.random() * (7-2)) + 2;
while(a==_root._currentframe){
a=Math.floor(Math.random() * (7-2)) + 2;
}
_root.gotoAndStop(a);
Now, heres the kicker. Often, the flash works fine, although it does like to favour frames 2, 3 and 5. Other times, on executing the swf, the randomly chosen clip fails to play, despite the play(); command.
Using the trace, I noticed it was trying to load and play frame 4, yet when I right clicked the flash and told it to play, the clip to load was the clip from frame 5!
I doubled checked all the code, and there is nothing out of place, all syntax is correct and i have used the same numbers in all the random generation code.
Can anybody shed some light on this very odd problem?
Thankyou!
if it dawns upon me i'll be back but just so you're not at a dead end:

