Sebastian
Sebastian

Reputation: 436

Flex: NumericStepper rounding up decimal number

I have the following NumericStepper:

<s:NumericStepper id="estimertTidCell" value="{isNaN(hostComponent.estimertTid)?0:hostComponent.estimertTid}" stepSize="0.5" maximum="5" change="hostComponent.estimertTid=estimertTidCell.value"/>

When i set the value to e.g. 1.5 through the NumericStepper and store the value, the alert in the following code correctly displays 1.5:

            private var _estimertTid:Number;


        [Bindable]
        public function get estimertTid():Number {
            return _estimertTid;
        }
        public function set estimertTid(value:Number):void {
            _estimertTid = value;
            Alert.show("numeric stepper set:" + value);
            invalidateSkinState();
        }

Problem: My problem is that once the NumericStepper refreshes, or reloads the variable, it displays 2 instead of 1.5, or 4 instead of 3.5 etc. Anyone got any ideas of what is causing this behavior? I would think that by setting the stepSize=0.5 it would correctly display those decimal numbers.

Additional information: When i display the same variable in a spark Label, the value is correctly displayed as a decimal number.

Upvotes: 0

Views: 2025

Answers (1)

Sebastian
Sebastian

Reputation: 436

At last! I found a small note that snapInterval has to be set to the same as stepSize or the value will be rounded up. So i hope my troubles help someone else in the future. Set snapInterval to the same as stepSze to avoid numbers rounding up

Upvotes: 3

Related Questions