Products
Technologies

Developer resources

Setting the value interval on a Spark NumericStepper control in Flex 4

Not yet rated

Problem

You need to set the value interval on a Spark NumericStepper control.

Solution

The following example shows how you can set the value interval on a Spark NumericStepper control in Flex 4 by setting the "valueInterval" property.

Detailed explanation

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/05/29/setting-the-value-interval-on-a-spark-numericstepper-control-in-flex-4/ -->
<s:Application name="Spark_NumericStepper_valueInterval_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo">

    <s:NumericStepper id="numericStepper"
            minimum="-50"
            maximum="50"
            valueInterval="2"
            horizontalCenter="0"
            verticalCenter="0" />

</s:Application>

And here is the “same” example in a more ActionScript friendly format:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/05/29/setting-the-value-interval-on-a-spark-numericstepper-control-in-flex-4/ -->
<s:Application name="Spark_NumericStepper_valueInterval_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        initialize="init();">

    <fx:Script>
        <![CDATA[
            import spark.components.NumericStepper;

            private var numericStepper:NumericStepper;

            private function init():void {
                numericStepper = new NumericStepper();
                numericStepper.minimum = -50;
                numericStepper.maximum = 50;
                numericStepper.valueInterval = 2;
                numericStepper.horizontalCenter = 0;
                numericStepper.verticalCenter = 0;
                addElement(numericStepper);
            }
        ]]>
    </fx:Script>

</s:Application>

For more information, see the original post (as well as many others) on FlexExamples.com.

Report abuse

Related recipes