6 Replies Latest reply on Dec 5, 2011 8:55 AM by avdave

    Not able to retrieve the children of VBOX inside a tab navigator

    avdave

      I have 2 VBox inside a tabNavigator.

       

        The code snippet of VBox I am interested is as below

       

      <mx:TabNavigator  id ="tabNav">

       

      <mx:VBox label="Class Details" name="clsDetail" id="ClsDetails" height="301" width="300" >

             <mx:FormItem label="PropID"  name="PropoId" id="propoIDForm" direction="horizontal">

                  <mx:NumericStepper id="propagatedIDInput" name ="objId"  minimum="0" maximum="100" stepSize="1" width="65"/>

             </mx:FormItem>

       

      <mx:FormItem label="Difficulty" direction="horizontal">

                          <mx:RadioButtonGroup id="difficulty"/>

                          <mx:RadioButton label="Easy" groupName="difficulty" value="1"/>

                          <mx:RadioButton label="Medium" groupName="difficulty" value="2"/>

                          <mx:RadioButton label="Hard" groupName="difficulty" value="3"/>

                </mx:FormItem>

       

      </mx:VBox>

      </mx:TabNavigator>

         I am trying to set the Numeric stepper runtime and I am not able to do it. Tried 2 approaches

       

      Approach 1: iterate through children and get the one

                                                         var VBoxChildren:Array = ClsDetails.getChildren();

                                                         for each(var currentFormItem:FormItem in VBoxChildren)

                                                         {

                                                                             var FormChildren:Array = currentFormItem.getChildren(); //somehow it is becoming null

                                                                                  for each(var currentItem:* in FormChildren) //doesn't go in since the array is null)

                                                                                       {

                                                                                                      if(currentItem is NumericStepper)

                                                                                                      {

                                                                                                                     (currentItem as NumericStepper).value = int(markedObject.propagatedID);

                                                                                                      }

                                                                                       }

                                                         }

       

      Approach 2: try to get children byname

       

        var myVBox:VBox = tabNav.getChildByName("clsDetail") as VBox;

        var frmItem:FormItem = myVBox.getChildByName("PropoId") as FormItem;//issue it becomes null ..somhownot able to get this children even though it is visible when I debug

      var  objId:NumericStepper = frmItem.getChildByName("objId") as NumericStepper; undefined as above is null

       

      I am not sure what am I missing here ...suggestions most appreciated!!

       

      Thanks

      Akshay