MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 133

Components language reference
Table of Contents

Advertisement

To create an application with the CheckBox component:
1.
Drag two TextInput components from the Components panel to the Stage.
2.
In the Property inspector, enter the instance names minimumAge and maximumAge.
3.
Drag a CheckBox component from the Components panel to the Stage.
4.
In the Property inspector, do the following:
Enter restrictAge for the instance name.
Enter Restrict Age for the label parameter.
5.
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
var restrictAgeListener:Object = new Object();
restrictAgeListener.click = function (evt:Object) {
minimumAge.enabled = evt.target.selected;
maximumAge.enabled = evt.target.selected;
};
restrictAge.addEventListener("click", restrictAgeListener);
This code creates a
text field components, which have already been placed on Stage. For more
maximumAge
information, see
CheckBox.click
To create a check box using ActionScript:
1.
Drag the CheckBox component from the Components panel to the current document's
library.
This adds the component to the library, but doesn't make it visible in the application.
2.
Drag the TextInput component from the Components panel to the current document's
library.
3.
In the first frame of the main Timeline, add the following ActionScript to the Actions panel
to create and position component instances:
this.createClassObject(mx.controls.CheckBox, "testAge_ch", 1,
{label:'Age Range', selected:true});
this.createClassObject(mx.controls.TextInput, "minimumAge_ti", 2,
{restrict:[0-9], text:18, maxChars:2});
minimumAge_ti.move(20, 30);
this.createClassObject(mx.controls.TextInput, "maximumAge_ti", 3,
{restrict:[0-9], text:55, maxChars:2});
maximumAge_ti.move(20, 60);
This script uses the method
CheckBox instance named restrictAge, and specifies a label property. Then, the code uses
the method
"UIObject.move()" on page 1375
event handler that enables and disables the
click
and
"TextInput component" on page
"UIObject.createClassObject()" on page 1362
to position the button.
Using the CheckBox component
and
minimumAge
1209.
to create the
131

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents