• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 8. Using Components > Using the PushButton Component

Using the PushButton Component

The PushButton component lets you add standardized buttons to Flash movies. This component lets you add buttons that simulate form buttons in HTML. All you have to do is add the component to your movie, provide a label and Click Handler, and you're finished. In this exercise you will provide labels for the two PushButton instances you added earlier in this lesson.

Select the submit PushButton instance, and change the Label parameter to Submit.


Press Return or Enter after you type a parameter value. You can also press Tab to apply the new value and jump to the next parameter.

Click the default value at the right of the Label parameter's name, and type your new value in the text box. If the label you add is too large for the button, it will be truncated. You can change both the height and width of the PushButton component to suit your taste.

Set the submit PushButton instance's Click Handler to processForm.

The Click Handler has the same function as the Change Handler for the CheckBox and ComboBox components, only it's triggered when the button is clicked. It simply assigns a function that should run when the button is clicked. The processForm function, which you will write in Lesson 9, handles the data in the form.

Select the clear PushButton instance, and set its Label to Clear.

You don't have to add a Click Handler for either PushButton instance yet. You'll do that in Lesson 9, when you modify the form you've created.

Set the clear PushButton instance's Click Handler to processForm.

It's a good idea to use the same function for each instance of a component. It will be easier to update the code when it's all in one place. The function has to check to see which component instance triggered it—you'll learn how in Lesson 9.

Look at the PushButton instances on the stage. Save the file as guestbook5.fla in the FlashTFS folder.

Both of the instances should have custom labels.

Now that you have your form set up, it's time to customize its appearance. Right now the components you've added are rather gray and boring. You can change their appearance to work better with the look of your Web site. You'll do that in the next two exercises.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint