Flash CS4 Button UI Component
We can create this button by coding ActionScript that will draw a button on the stage for us. But for this tutoiral, we will use the built-in button UI component. We will start working on the last frame of the Timeline. Open your ecard into Flash CS4.
- Add a new layer just under the Actions layer. Name this new layer “Replay”. We will use this layer to hold our button.
- Add a Keyframe on Frame 105 of the Replay layer. This will insure that the button isn’t visible until this last frame.
- Open the Components panel (Window – Components). This panel has two sections, the User Interface and Video sections. The button component is in the User Interface section. Click and drag an instance of the button component onto the stage just under the text.
- Select the button. In the Properties panel, give the button an Instance Name of “Replay”.
- Open the Component Inspector panel (Window – Component Inspector). We use this panel to set the values for the parameters of our button component. The Label parameter controls the text on the top of our button. Right now, it says “Label” on the button because the value for the Label parameter is set to “Label’ . Let’s change the value of this parameter to “Replay”. You should see the text on the button change from “Label” to “Replay”.
If we test the ecard now, nothing happens when we click the Replay button. That’s because we still need to add a behavior to the button.
- Click on the last frame of the Actions layer and open the Actions panel. After the stop(); code, add the code below. This code tells Flash to listen for a mouse click on the Replay button. When there is a mouse click, Flash carries out the replayMovie function. This function has only one line of code that tells Flash to go back to Frame 1 and play the movie.
Editor's Picks Articles
Top Ten Articles
Content copyright © 2019 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.