Web
Article

Flash Script – Checkbox Component

By Georgina Laidlaw


Utilizing the checkbox component is easy.

1. Open the components panel by hitting ctrl+f7.

2. Drag the checkbox component onto the stage, and select the checkbox component in Frame 1. The component’s parameters will be displayed in the Property inspector.

3. Type "cbox" into the Property inspector Instance Name text box, to name the component.

4. Next, we need to specify whether we want the initial state of the CheckBox component to be selected or unselected.

To have the checkbox autonatically appear selected, access the Initial Value parameter pop-up menu, and select "True".

5. In the Label Placement parameter pop-up menu, check that the default value is set to right alignment. This ensures the label will be displayed to the right of the checkbox.

6. Type "f1" for the Click Handler name. Later, of ocurse, you will write ActionScript to define what the Click Handler should do.

7. Select the first key frame from the existing layer. Press f9 to open the actions box, and insert the following action:

function f1() 
{
cbox.setLabel("Checked")  
}

8. The above action is simple. When you click on the checkbox, it calls the function f1(). This function sets the label of checkbox to "Checked". It’s that simple!

Download the sample files here.

Free Guide:

7 Habits of Successful CTOs

"What makes a great CTO?" Engineering skills? Business savvy? An innate tendency to channel a mythical creature (ahem, unicorn)? All of the above? Discover the top traits of the most successful CTOs in this free guide.

No Reader comments

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Front-end, once a week, for free.