User Guide
NumericStepper component 589
NumericStepper parameters
You can set the following authoring parameters for each NumericStepper instance in the Property
inspector or in the Component inspector:
value sets the value displayed in the text area of the stepper. The default value is 0.
minimum sets the minimum value that can be displayed in the stepper. The default value is 0.
maximum sets the maximum value that can be displayed in the stepper. The default value is 10.
stepSize sets the unit by which the stepper increases or decreases with each click. The default
value is 1.
You can write ActionScript to control these and additional options for the NumericStepper
component using its properties, methods, and events. For more information, see
“NumericStepper class” on page 592.
Creating an application with the NumericStepper component
The following procedure explains how to add a NumericStepper component to an application
while authoring. In this example, the stepper allows a user to pick a movie rating from 0 to 5 stars
with half-star increments.
To create an application with the NumericStepper component:
1.
Drag a NumericStepper component from the Components panel to the Stage.
2.
In the Property inspector, enter the instance name starStepper.
3.
In the Property inspector, do the following:
■ Enter 0 for the minimum parameter.
■ Enter 5 for the maximum parameter.
■ Enter .5 for the stepSize parameter.
■ Enter 0 for the value parameter.
4.
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
movieRate = new Object();
movieRate.change = function (eventObject){
starChart.value = eventObject.target.value;
}
starStepper.addEventListener("change", movieRate);
The last line of code adds a change event handler to the starStepper instance. The handler
sets the
starChart movie clip to display the amount of stars indicated by the starStepper
instance. (To see this code work, you must create a
starChart movie clip with a value
property that displays the stars.)