Using the PushButton Component

I l @ ve RuBoard

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.

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

    graphics/08fig33.gif

    NOTE

    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.

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

    graphics/08fig34.gif

    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.

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

    graphics/08fig35.gif

    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.

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

    graphics/08fig36.gif

    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 ityou'll learn how in Lesson 9.

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

    graphics/08fig37.gif

    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.

I l @ ve RuBoard


Macromedia Flash MX. Training from the Source
Macromedia Flash MX: Training from the Source
ISBN: 0201794829
EAN: 2147483647
Year: 2002
Pages: 115
Authors: Chrissy Rey

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net