Buttons

First, just draw a rectangle or any shape that you want your button to be. Make sure it's on its own layer. Now convert this shape to a symbol but make the type **BUTTON.** So far we have set the type to Movie Clip, but for a button make the type **BUTTON.**
 * How do you create a button symbol?**


 * What do the four frames in the button symbol represent**


 * Up**
 * When there's not a mouse anywhere near it (what it looks like normally)
 * Over**
 * When you put your mouse over the button without clicking (hovering over the button with the mouse)
 * Down**
 * When you click the button but haven't let go yet.
 * Hit**
 * What portion of the button counts as the button. If you decide to put a keyframe in the hit frame (optional not necessary), you can move the actual button (not the text) to a different area or change its size, and when the mouse goes over that area the button affects will be put into action.


 * In an external actionscript file, how do you tell the button to run a function when it is pressed?**


 * Click on the stage and then in the class space name the stage. Make sure the name starts with a capital letter for example "BallDemoMain"**.**
 * Now go to File => New and click on ActionScript File. Now save this file as the same name that you put into the class space.as : Example name: "BallDemoMain.as" . **YOU MUST SAVE THIS FILE IN THE SAME FOLDER AS YOUR ORIGINAL FILE.**


 * Follow the following code. **BE SURE TO MAKE SURE THE NAME OF THE CLASS IS CONSISTENT THROUGHOUT THE CODE. IN THE FOLLOWING CODE THE NAME OF THE STAGE WAS "BallDemoMain".**
 * Also, you will name your button as something (when you click the button in the .fla file, you can name it in the top right as an instance). Make sure that whenever we refer to the button by this name the spelling is the same in the code as it is in the .fla file.
 * In the following code, the code makes the button say "Hello there!" and play (continue going around in a triangle while spinning).

package { import flash.display.*; import flash.events.*;

public class BallDemoMain extends MovieClip { public function BallDemoMain { thePressMeButton.addEventListener(MouseEvent.MOUSE_UP,resumeTriangle); }

public function resumeTriangle(evt:MouseEvent) { trace("Hello there!"); play; }

}

}