tags:

views:

81

answers:

2

Hi,

I am a newbie to Flex and programming. I am trying something where I have 2 Numeric Steppers. One numeric stepper holds values from 0-230 and the other from 0.00-0.99. My question is how to change the value of the first numeric stepper when the second numeric stepper goes from 0.99 to 0.00. Suppose the first numeric stepper has a value 10 and the second numeric stepper is being incremented continuously. As it reaches 0.99 and on mouse up on the up arrow, 10 should change to 11 and this numeric stepper goes to 0.00.

Could anyone help me out with some code or suggestion?

Thanks is advance, REDDY

+1  A: 

One of the solutions:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:NumericStepper minimum="0.00" maximum="1" value="0.98" stepSize="0.01" change="check_step()" id="stepper1"/>
    <mx:NumericStepper value="10" maximum="230" stepSize="1" id="stepper2"/>
</mx:Application>

Script:

private function check_step():void{
    if (stepper1.value == 1){
        stepper1.value = 0;
        stepper2.value = stepper2.value+1;
    }
}
Ladislav
Don't know if you wanted to change once 1st nummericStepper gets to 1 or to 0.99. All there is to do is change stepper1.value == 1 to stepper1.value == 0.99 for example
Ladislav
A: 

Thanks Ladislav,

Aftet stepper1 reaches 0.99 it goes back to 0. What shld be done if this function has to be written for multiple sets of numeric steppers, I mean how to generalize this function for multiple numeric steppers?

Thanks again,

REDDY

REDDEY