![]() ![]() | |
The NumericStepper can be used anywhere you want a user to select a numeric value. For example, you could use a NumericStepper component in a form to allow a user to set their credit card expiration date. In another example, you could use a NumericStepper to allow a user to increase or decrease a font size.
The following are authoring parameters that you can set for each NumericStepper component instance in the Property inspector or in the Component Inspector panel:
value sets the value of the current step. The default value is 0.
minimum sets the minimum value of the step. The default value is 0.
maximum sets the maximum value of the step. The default value is 10.
stepSize sets the unit of change for the step. The default value is 1.
You can write ActionScript to control these and additional options for NumericStepper components using its properties, methods, and events. For more information, see NumericStepper class.
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 Button component, do the following:
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.)
![]() ![]() | |