Welcome to WebmasterWorld Guest from 54.196.233.239

Forum Moderators: open

Message Too Old, No Replies

random animation

actionscript question

     

modouno

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")
or
gotoandplay ("animation2")
or
gotoandplay ("animation3")

etc...

I hope i make sense here, thanks.

korkus2000

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