0 Replies Latest reply on Jul 12, 2007 11:23 AM by Handycam

    Getting Stepper Values

    Handycam Level 1
      I've got a form with a series of form items like:

      <mx:FormItem>
      <mx:HBox>
      <mx:CheckBox id="c0" width="{colW}" label="{ingredientList.getItemAt(0).label}" change="enableStepper(q0,c0)" selected="false" />
      <mx:NumericStepper id="q0" width="{nsW}" minimum="{ingredientList.getItemAt(0).min}" maximum="{ingredientList.getItemAt(0).max}" stepSize=".5" enabled="false" />
      <mx:Label text="{ingredientList.getItemAt(0).units}"/>
      </mx:HBox>
      </mx:FormItem>

      When someone checks one of the checkboxes, the attached handler enabled the spinner that goes with it.

      I need to be able to loop through all the numeric steppers, check if enabled is true and if it is, add the running total to a variable.

      I can get ONE (without a loop) by simply:

      var myTotal:Number = q0.value;

      I tried starting something like:

      private var ttlQty:Number = 0;
      private var totalCheckboxes:Number = 26;

      private function choiceHandler():void {
      for(var i:int = 0; i<totalCheckboxes; i++){
      ...
      }

      But it doesn't work since I can't get the q0, q1, q2 etc. in the right format.

      Help appreciated.