Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

random animation

actionscript question



5:39 pm on Jan 3, 2007 (gmt 0)

5+ Year Member

I have a flash movie I have created, and I have an animation that rolls before you have options to click on different things. What I want to do is create 2 or 3 more opening animations, then when the flash movie loads have it randomly choose which animation to show.

I figure i can set each animation up on the timeline, but i'm not real sure if i can make the movie choose which animation to play.

I know this action below won't work, but it might better explain what i'm trying to do.

on load

gotoandplay ("animation1")
gotoandplay ("animation2")
gotoandplay ("animation3")


I hope i make sense here, thanks.


6:42 pm on Jan 5, 2007 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

In actionscript you can use this to get your random number of the animation

randomNum = Math.floor(Math.random() * (high - low)) + low;

if(randomNum == 1){
gotoandplay ("animation1")

High is the number of animations you have and low would be 1. Then just create if statements to play the sections you want. I don't have flash out to test this right now but it should get you started.


Featured Threads

Hot Threads This Week

Hot Threads This Month