Random frame on load

Is there a way that when the flash movie starts it loads into a random frame everytime. As well as a button that would do the same thing.

Thanks LOTW

Heh I’m working on a randomizing proj but not this type… I’m doing text

On the first frame (or in a seperate MC first frame - may be put in into [COLOR=blue]onClipEvent (load)[/COLOR] put:

(Say you had content or animation or whatever from frames 2 - 10):

[COLOR=blue]gotoAndPlay (random ( 9 )+2);[/COLOR].

I know it adds up to 11, but if you use (8)+2 you’d get a number from 2 - 9.

On frames 2 - 10 place your animations or contents, etc. with a [COLOR=blue]stop();[/COLOR] otherwise the movie will keep jumping to random locations. Unless this is what you want, in which case you could send the movie clip back to the frame that contains the goto and play random action continuously.

It’s 3:44 am here so If this doesn’t make sense you know why.

Actually mine’s text too. It’s going to be a random quote generator. Each time someone visits my site it will display a different quote. Or if they press a button it will pull a random quote. Each quote is on a different frame. Simple yet effective.

LOTW

If you want randomize just the quate you can make 1 frame … then put dimamic text field …
and acton…
you can use time for randomation… lets say seconds … and then put case …

I quete i new thith action script… so I will write with mistakes… I hope you get the point…

case getsec {
0 >> quatetext = “quate 0 is hare”
1 >> quatetext = “quate 1 is hare”
2 >> quatetext = “quate 2 is hare”


57 >> quatetext = “quate 57 is hare”
58 >> quatetext = “quate 58 is hare”
59 >> quatetext = “quate 59 is hare”
}

… just check the sintaks for using case … or swich … I dont remember …
and proper getsec finction.

GL.

I actually used the gotoAndPlay random function and that seems to work well.

Thanks everyone, LOTW

Deril’s method is much much much better. You can have everything in the same frame, and it’s much more dynamic than your present method. It’s switch by the way (tutoriaL on this site), but switching the seconds is not necessary, you can simply generate a random number.

pom :asian:

I’ll give that tut a try, thanks, ilyaslamasse

LOTW

hi guys…

This isnt exactly what you are asking for… but its cool anyway… it loads a random picture into a flash file… theres a tutorial here:

carbonfour.com

Random Flash tutorial

enjoy.

There is a tutorial for that at www.kirupa.com too.

oh whoops… sorry just trying to be helpful :slight_smile:

Hey, the more tutorials the better. They more than likely use 2 different methods of doing it. This increases the knowledge of people wanting to know how to do it:)

It is better to know more than 1 way in case the situation changes where you need it a certain way. I just wanted to give kirupa some support:P

Does anyone know the exact code I would need to put in to get this to work???