2011-12-05 9 views
1

tabNavigatorの中に2つのVBoxがあります。Flex 3.5:タブナビゲータ内でVBOXの子を取得できません

私が興味を持ってのVBoxのコードスニペットは、私が数値ステッパーランタイムを設定しようとしています

<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> 

以下のようであり、私はそれを行うことができないのです。試した2つのアプローチ

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 

私はここに何が欠けているのかわかりません。

Thanks 
Akshay 
+1

あなたはなぜですかその多くのコーディングを使用しますか?私は理解していない!実行時に 'propagatedIDInput.value = int(markedObject.propagatedID);のような値を直接割り当てることはできません。 –

+0

私は実際にそれをやろうとしていました。しかし、私は打ちのめされたインスタンス化によって不明のままNumeric stepperが初期化されていないので、参照を取得していませんでした...それが私に当たって、creationPolicy = all(どちらのソートが目的を破る)を設定し、チャーム – Akshay

答えて

0

実際defferedインスタンス化の問題は、TabNavigatorコンテナの内側に私の子コンポーネントを設定していませんでしたし、ちょうどのVBox(第一子)を設定して...私は、Adobeのフォーラムで私の質問を投稿し、応答がそれを解決しました...

私が行方不明になったすべては、すべての(上記の私のコメントで説明したように)=にcreationPolicyを設定することでした...そしてそれは魅力のように働いた。..

ここではFlexコンポーネントhttp://puremvc.org/content/view/91/188/

のdeffered instatiationについてPureMVCのには良いの読み取りです