flash button

Out of context: Reply #5

  • Started
  • Last post
  • 7 Responses
  • fyoucher10

    1. Create a movieclip (not a button) with two animations inside that come to a stop. At the beginning of each animation add a frame label to a separate layer (create a blank keyframe, select the keyframe, and then in your propoerties inspector, type in a name for the frame). Call these frame labels "rollover" and "rollout" (without the quotes).

    2. Give that movieclip an instance name. ( Select the movieclip, then go to your properties inspector and type in a name). For this example, we'll call it "test_btn" (without the quotes).

    3. On the same timeline where you added that button to the stage, create a new separate layer and call it "Actions". This is where you'll put your code. Make sure you don't have anything selected. You don't want to add code to the movieclip. You want to add code to the frame. So click off the stage somewhere to deselect everything.

    4. Create a blank keyframe on the Actions layer at the same frame number (or later) as to where the moveclip instance is on. So if your movieclip is on frame 1, then you should add code to frame 1. If your movieclip is on frame 65, then you might want to add your code to frame 66.

    5. Select the blank keframe in your timeline. Now open up the Actions panel. This is where you add code.

    6. Type the following code into the Actions panel:

    test_btn.onRollOver = function (): Void
    { this.gotoAndPlay("rollover"); }

    test_btn.onRollOut = function (): Void
    { this.gotoAndPlay("rollout"); }

    Now test the movie. That should be it.

View thread