A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [Resolved] Math.Random help???

  1. #1
    Junior Member
    Join Date
    May 2005
    Posts
    3

    Math.Random help???

    Okay, so maybe it's late or maybe I've just been working on this project too long... but I can't seem to remember how to use the math.random function to do what I'm trying to do. I'm using Flash MX and I have a movie clip which will eventually have 24 labeled keyframes (beta1, beta2, beta3, ...) as marking points. When the movie clip starts playing I want to randomly jump to one. How do I use Math.random to make this happen? I know it also Math.floor but I can't seem to remember how the two go together! Please advise. To help you visualize the idea, the movie is attached. Note that only half of the markers are labeled so far! Thanks for your help in advance.

    Sleep weary,
    M. Vaughn
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    a field
    Posts
    95
    I cant remember the changes 2004 made to MX but in 2004 the AS would be.

    code:
    _root.alphabeta.gotoAndPlay("beta"+random(12));



    Apply that to your first _root frame. Iv attatched the changed file, seems to work for me fine.
    Attached Files Attached Files

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