14.+Play+Button

1. When you create the Flash File, select ActionScript 3. 2. Draw something that will be a button. Make sure there are no empty spaces in the drawing (otherwise there will be holes in your button). 3. Select your drawing, right-click on it and click on “Convert to Symbol” The window below will appear. Select “Button” from the drop down list and click OK.
 * Play Button**

4. With the button selected, go to the Properties panel and change  to something like btn1, btn5, or btn_play. The name should start with a letter and have no spaces. ActionScript is case-sensitive so it is usually simpler to stick with lower-case letters, numbers, and the underscore character.

In this example I named the button //btn//. 5. Right-click on the timeline on thekey frame where your button is. Selection Actions. Enter the code shown in the figure. ActionScript is case-sensitive.


 * * stop must have the empty parentheses
 * btn is the name I gave the button.
 * handle_btn is the name I gave the function (same naming rules as before apply).
 * Other commands besides stop and play are:
 * gotoAndStop( 10 )
 * gotoAndPlay( 10 )
 * which send you to frame 10. Obviously other frame numbers can be used. ||

Here are some guidelines/rules if you have more than one button.
 * Two functions cannot have the same name (even if the functions are in different key frames).
 * Use a different name for each button.
 * Usually there is one function for each button.

Open up your frame by frame animation and insert a play button. We will walk through this together. Make sure to rename the button btn so it matches the script.
 * Part I: together **

Copy and Paste the script below... stop btn.addEventListener(MouseEvent.CLICK,handle_btn);

function handle_btn(e:MouseEvent):void { gotoAndPlay(2); }

Now that we inserted a button together, try it on your own. Insert a play button into your Kinetic Typography and then upload it to the wikipage. Best of luck!
 * Part II: The Challenge **

**Objective** :
 * Use Action Script
 * Add Action Script to create a play button
 * You should be able to click on the play button, watch your movie and the movie returns to the play button.