A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: << Random gotoandPlay >> ©

  1. #1
    Member
    Join Date
    Jan 2003
    Location
    CPU
    Posts
    38

    << Random gotoandPlay >> ©

    Hi!

    how can a make a random gotoandPlay? [random between frames]

    thank u

  2. #2
    Member
    Join Date
    Dec 2002
    Posts
    97
    Use the Math.random and Math.floor methods (explained in online help & the AS dictionary). The code below, on a button, sends the playhead to a random frame between 1 and 30:

    on(release){
    randomFrame = Math.floor(Math.random() * 30 + 1);
    gotoAndPlay(randomFrame);
    }

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    CPU
    Posts
    38
    Originally posted by Mollose
    Use the Math.random and Math.floor methods (explained in online help & the AS dictionary). The code below, on a button, sends the playhead to a random frame between 1 and 30:

    on(release){
    randomFrame = Math.floor(Math.random() * 30 + 1);
    gotoAndPlay(randomFrame);
    }
    thanks

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