- Open Flash CS4
- Click Flash File (Actionscript 3.0)
- Create a symbol with Insert>New Symbol
- Name the file “button” and choose button from the drop-down box
- Draw a light green rectangle
- Make a text box and type anything you want
- Center the text in the middle of the rectangle
- Select everything
- Create a keyframe underneath where it says “Over” on the timeline
- Fill in the rectangle with dark green, making sure the text isn’t selected
- Choose Edit>Edit Document to return to the document
- Open the Library and drag the image of the button to the work area
- Test the button by choosing Control>Test Movie
Now its time to make the button clickable:
- Double click on button in your library. This should open up a new window where you can edit your button. Notice that the timeline has changed now. Now, the timeline says “Up” “Over” “Down” “Hit” This is where you edit how the button reacts to the mouse.
- Leave the “Up” event the same and copy the “Up” event frame and paste the frame in the “Down” and “Hit” spots. Now, go to the “Over” event and change the color of your button to anything that looks good to you.
- You can now test your movie. It should be when you roll over the button with your mouse that it changes color and when you click on the button, it changes to your “Hit” color.
- Now it is time for the code part. This code will make the button change positions in the timeline. Go to frame one and press F9 to open the actions panel and put the following code:
stop();
import flash.events.MouseEvent;
My_btn.addEventListener(MouseEvent.CLICK, CursorClick);
My_btn.addEventListener(MouseEvent.MOUSE_OUT, CursorOff);
function CursorClick(event:MouseEvent):void{
gotoAndStop("2");
}
function CursorOff(event:MouseEvent):void{
gotoAndStop(1);
}
- Create a new keyframe and draw something on frame two.
- Test your video and have fun!
©2011 Mr. D. Sader | Communication Technology | All Rights Reserved
.
Original post by Mr. D. Sader