Flash Tutorial on MovieClip Buttons By John Riddle
In this tutorial I will discuss how to make a button that when you click it it goes to another frame and plays the rest of the clip so you can use this to make your page a little more interactive.
1. First you just need to make any shape and convert it to a symbol and name it “Button” also down in the property inspector, give the button an instance name. call it “BTN”. You will do all of this on frame 1 in the timeline.
2. Now create another layer called “my movie” and create whatever it is you would like to play when you click the button on frame 2 of the main timeline.
3. Create another layer in the timeline called Actions.
4. Go into the actions layer on frame 1 of the main timeline and open up the action script panel. Now type
5.Now we are going to place the code in the action layer for the button you already created called “button” and with the instance name of “BTN”.
6. This is the exact code you need to type in the actions panel for the button to work on frame 1 in the actions layer.
function moviebutton (event:MouseEvent):void
To explain the code above.
BTN.addEventListener(MouseEvent.CLICK,moviebutton); takes the instance name and sets it up to be on the look out for a mouse click so when that button is clicked it runs the function “moviebutton”.
You can also make numerous buttons with these same actions.
The same code can be applied with a gotoAndStop();