A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: random intro?

  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    101

    random intro?

    Hi, I have six flash movies. When the user visits the web page I want one of the movies to play. It can be anyone, the more random the better. What is the best way to acheive this?

  2. #2
    Ninja Rider Jhonte's Avatar
    Join Date
    Sep 2004
    Location
    Uppsala,Sweden
    Posts
    253
    just make an array with your movies in.
    then randomise a index that goes from 0 to the length of your array and load that movie.
    Show me the way to the next whiskeybar ...

  3. #3
    Senior Member
    Join Date
    Aug 2003
    Posts
    101
    not great with actionscript, how do I do an array?

  4. #4
    FlashCLUE.com Wizzz's Avatar
    Join Date
    Nov 2005
    Location
    Warsaw Poland
    Posts
    451
    code:
    trace( [1,2,3,4].sort( function(a,b){ return random(3)-1; } )[0] );


  5. #5
    Senior Member
    Join Date
    Aug 2003
    Posts
    101
    thanks for the code, but where do I put it? in a blank movie or at the beginning of each of the six movies?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center