Make a Play Button for an Animation in Adobe Flash Cs4
You made an animation, but when you see that, it just starts playing. But you want to make this stop first and when a button will be pressed, it will start playing. Then go on reading to do this.
Steps
- Draw a button by drawing a rectangle or you can use one from Windows->Common Libraries->Buttons. If you'll choose button from common libraries, then skip following steps until you reach at Step-7.
- Use Text tool to write "Play" or anything you want above the rectangle. The text must be static text.
- Select both text box and rectangle and convert it to symbol by Right click->Convert to symbol.
- Name it Playbutton or something you want, select middle point as registration point and select Button. (not movieclip, not graphic, button)
- Double click your newly made button in the stage. This will take you to a new page where there will be another set of empty frames and a bar at the top which also says scene 1 and the name of your button.
- On the second frame (over), make a new keyframe and draw what it will look like when you roll over it.
- Press Scene 1 on the top bar and move your button to place it anywhere on the stage.
- Select the current frame (which contains the button) and press F9.
- Type or copy and paste below action script in Action panel.
stop();
- Due to this statement animation will stop at that frame.
- Click the button from the stage and press F9. This takes you to the Action panel.
- Copy and paste this script.
on(release){ nextFrame(); }
- on(release) means on release of your mouse click from the button the next statement or block will invoke. { starts a block . nextFrame(); means go to the next frame. Instead of nextFrame(), you can put gotoAndStop(frame you want to go) and the } means end of block or function.
- Go to Control->Test movie to test your work. Select File->Publish to publish your work.
Tips
- To publish in different file format, go to File->Publish setting.
Warnings
- This only works for actionscript 2 not for actionscript 3.