Flex 3.5:无法在选项卡导航器中检索 VBOX 的子项
我在 tabNavigator 中有 2 个 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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 adobe 论坛上发布了我的问题,响应解决了它...实际上,延迟实例化的问题不是在选项卡导航器内设置我的子组件,而只是设置 VBox (第一个子组件)...
我所缺少的只是设置createPolicy = all(正如我上面的评论所解释的)...它的工作方式就像魅力..
这里有一篇关于 PureMVC 的关于 Flex 组件延迟实例化的好读物 http://puremvc.org/content/view/91/188/
I posted my question on adobe forum and the response solved it...actually the issue of deffered instantiation was not setting my child components inside a tabnavigator and were setting just VBox ( the first child)...
All I was missing was to set creationPolicy = all(as explained by my comments above) ...and it worked like charm..
Here's a good read on PureMVC about deffered instatiation of Flex components http://puremvc.org/content/view/91/188/