User Login





Register
Forget Password

Hostings with very low prices

Hosting Plans Starting at 1$/Month

BaydHost

Powered By

  • AhmBay
  • Actionscript jump to random frame - ActionScript Webmaster Tips, Knowledge Base Webmaster Tools

    Home > ActionScript > Actionscript jump to random frame
    Category: ActionScript
    Written by: Admin
    Date: 2008-11-10
    Rating: 0   Puan:0 | Katılımcı:0 | Voted : 0 times
    Hit: 886
      

    In this Macromedia Flash tutorial I will show you how to make a simple actionscript code to jump to a random frame in the timeline.


    1. In the layers panel name the layer we are working with button_layer.
    In the timeline right click at frame 5 and create a new keyframe.

    Now make graphic for a button, right click and convert it to a movie clip.


    2. Now make a new layer in this at frame 1 type in "frame 1" with the text tool on the stage.
    make a new keyframe at frame 2,3,4 and 5 and make a text graphic with the text "frame 2", "frame 3", "frame 4" and "frame 5"

    3. Now go to frame 1, select the button and go to the actionscript panel.



    4. Type in the following code in the actionscript panel.



    on (release) {
    gotoAndStop(random(5));
    }



    What this does it to tell flash, every time the mouse button is released on the graphic button then flash will jump to a random frame between 1 and 5 and then stop.