Forum Moderators: open

Message Too Old, No Replies

Generating new random numbers

         

zxk105

8:16 pm on Nov 24, 2004 (gmt 0)

10+ Year Member



I have created six different movie clips (all same length) and placed them in six different layers. Now what I want to do is create a random number and then play the corresponding movie clip. Once this movie clip is done I want to generate a new random number and hopefully play a different movie clip, and on and on and on. How do I do that? This is the code I placed in the frame on another layer. But the same movie clip keeps running over and over. Thanks....


//Generate a random number between 0 & 5
n = random(6);

//Stop all non-chosen movie clips
for (z=0; z<6; z++) {
mc = "title" + z;
if (z!= n) {
tellTarget(mc){
stop();
}
}
}

helpful

1:51 pm on Nov 25, 2004 (gmt 0)

10+ Year Member



see the follwing example at:

[uploads.savefile.com...]

The example has been shown with 3 movieclips.

zxk105

7:33 pm on Nov 25, 2004 (gmt 0)

10+ Year Member



Well I can't open the flash file. It says, "Unexpected file format.", for some reason. Can you please explain to me how this is done. Or maybe paste the code. Thanks...

helpful

1:52 am on Nov 26, 2004 (gmt 0)

10+ Year Member



The file has been created using flash mx 2004. What version are u using?

helpful

2:50 pm on Nov 26, 2004 (gmt 0)

10+ Year Member



I have recreated the example in flash 5. if you have flash 5 or higher u will be able to view this file.

[uploads.savefile.com...]

(the server in which the file has been uploaded is not working properly today so u may have to try 3-4 times to download the file)

zxk105

3:15 pm on Nov 26, 2004 (gmt 0)

10+ Year Member



It works now! Thanks a lot. I'll look at the code and apply it to my animation. If I still have any issues I'll be back. Thanks....

zxk105

7:45 pm on Nov 26, 2004 (gmt 0)

10+ Year Member



Alright so I have 8 movie clips being played. I used your code (thanks for that) and adjusted it to my movie. However, my movie clips will play for a while and then just stop. Why is that happening? If you want to look at the movie you can click here [snowman.ca]. Just let it play for a while and it will probably stop playing. If you want to download the files you can do so here [snowman.ca]. Thanks!

helpful

7:08 am on Nov 27, 2004 (gmt 0)

10+ Year Member



download the file:

[moumita.savefile.com...]

and go through the details.txt file first.