homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

random animation
actionscript question

5+ Year Member

Msg#: 3207031 posted 5:39 pm on Jan 3, 2007 (gmt 0)

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.



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

Msg#: 3207031 posted 6:42 pm on Jan 5, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved