I was looking for a way to create a no-maximum NumericStepper and came up with
the idea of listening to the Change event and just upping the maximum value by
1-stepSize unit above the current value.
The only thing was, I needed to use a callLater() in order to change the
maximum or else the change didn't take effect in time.
So I would suggest a listener on each, in which you would calculate the new
maximum of the "other" two steppers, then perform a callLater that looks like
this:
callLater(resetMaxValues, [newMaxValue, stepperA, stepperB])
... and then something like this:
private function resetMaxValues(newMaxValue:int, stepperA:NumericStepper,
stepperB:NumericStepper):void
{
stepperA.maximum = newMaxValue;
stepperB.maximum = newMaxValue;
}
--- In [email protected], "Tracy Spratt" <tspr...@...> wrote:
>
> I have a change event handler on each. It would perform the logic and
> adjust the other three. Or is it the logic itself you are asking about?
>
> Tracy
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of grimmwerks
> Sent: Saturday, April 05, 2008 5:50 PM
> To: [email protected]
> Subject: [flexcoders] weird NumericStepper question / script
>
>
>
> I've got 4 NumericSteppers; and the problem I'm having is one I can't
> get my head 'round: the values of all the NumericSteppers have to add
> up to 100.
>
> On the whole I could easily check via a 'submit' button if they don't
> addup, but I'd like to check on any of the stepper's 'change' function
> -- what I was thinking was:
>
> As a one is going up, the maximum of all the others goes down in a
> cycle (ie if someone is putting numB, then C then D -- they're max
> slowly goes down.
>
> If the max value of a numeric stepper meets the current value of that
> stepper, and there's no more 'room' -- then the user can't keep
> increasing the size of the current numeric.
>
> Is this making sense? In other words, how does one tie in the value of
> one stepper with another to equal 100. Sure, having 2 steppers makes
> it easier somewhat, but with 4 I don't know how best to pay attention
> to them all while still keeping the numbers validating.
>
> I'd appreciate any thoughts.
>