PDA

View Full Version : HELP! Need to load random flash movies



jakesterb
04-05-2005, 01:46 AM
Hey,

I am pretty new to Flash and need to load random flash movies (.swf files) in a sequence of fixed movies. For instance, lets say I have a repearting loop consisting of 5 movies (M1, M2, M3, M4, M5) each calling on one another. However, what I am looking to do is have M1, M3, and M5 in the loop constant and have M2 and M4 replaced with other random movies (located in another seperate folder) as the loop continues.

Please Help!!

NTD
04-05-2005, 06:57 PM
Hi,

Flash allows for many ways to achieve the same goal. This might be one way........ In movie 1 and 3 on the last frame,..... load the next movie based on a random variable......

myRandom=random(4);

loadMovie("myMovie"+myRandom);

random(3) will return a random integer from 0-3

If you wanted to have a random number excluding zero.....

myRandom=random(3)+1;....... returns a random number 1-3

Odisey
12-08-2008, 01:57 AM
Hello,
I tried loading a random movie clip using this thread and of course it executes fine. I have a question - making this a little more complex.

The example here - the one I used - grabs 1 random number - which I used to load a MC into a container such as:


stop();
myRandom=random(3)+1;
loadMovie("movie"+myRandom+".swf", container); I would like to do a few things beyond this. The most complex is instead of grabbing 1 random number of 3 I would like to grab 3 random numbers of 8.

These random numbers are going to do a few things.

They are going to load three different movie clips over three seconds. Random clip 1 loads into a container, one second later random clip 2 loads into a container, one more second later random clip 3 loads into a container. Then one more second later an enter frame clip event will reload the entire screen with a quiz MC.

So in short - three random clips are shown to the viewer over three seconds. Then they are presented with a screen that allows the user to think about what they saw for 8 seconds. After 8 seconds they are shown another MC that displays a random MC1 through 8. The viewer then selects a button - either YES or NO (Either the 4th random MC is one they actually saw during the three seconds of MCs they initially viewed or it was not). This information is sent to the db.

So what I am asking is this. If we can generate three random numbers from 1-8 to load the first three movies over three seconds, can we compare the values of that array with the value of the very last random number generated to load the 4th and last quiz MC to determine if their is a match?

If their is a match a YES would populate the db as "correct"! (ie, 1,4,7 compared to 4) If their is not a match a YES would populate the db as "incorrect" (ie, 1,4,7 compared to 2). If their is a match a NO would populate the db as "incorrect" (ie, 1,4,7 compared to 7). And lastly, if their is not a match a NO would populate the db as 'correct' (ie, 1,4,7 compared to 3).

Can we find some help setting this up?

Thank you,
Odisey