将子组件添加到 VBox 组件 (FLEX)
首先,我想提前感谢所有阅读这篇文章的人。
我在将子组件添加到 VBox
组件时遇到问题。这不是同一件事吗?:
列表项:
<mx:Script>
<![CDATA[
public function addChildren():void {
var f:FaqItem=new FaqItem();
f.id="newUsersAssistance";
this.cont.addChild(f);
}
]]>
</mx:Script>
<mx:VBox id="cont" width="100%" borderThickness="0" verticalGap="0"/>
和:
<mx:VBox id="cont" width="100%" borderThickness="0" verticalGap="0">
<view:FaqItem id="newUsersAssistance" />
</mx:VBox>
我从辅助文件(使用 BabelFX)向 FaqItem
组件注入两个属性(问题和答案),这取决于 FaqItem
的 id code>FaqItem,但只有当我选择第二个选项时它才起作用。如果我使用第一个选项,我会得到一个孩子,但问题和答案字段中的文本为空。我需要使用第一个选项。
我做错了什么吗?
再次感谢一切 亲切的问候
First of all I wanted to thank in advance to everyone that reads this post.
I'm having a problem when adding a child to a VBox
component. Is it not the same thing?:
List Item:
<mx:Script>
<![CDATA[
public function addChildren():void {
var f:FaqItem=new FaqItem();
f.id="newUsersAssistance";
this.cont.addChild(f);
}
]]>
</mx:Script>
<mx:VBox id="cont" width="100%" borderThickness="0" verticalGap="0"/>
and:
<mx:VBox id="cont" width="100%" borderThickness="0" verticalGap="0">
<view:FaqItem id="newUsersAssistance" />
</mx:VBox>
I am injecting two properties (question and answer) to the FaqItem
component from an auxiliar file (using BabelFX) that depends on the id of the FaqItem
, but it is only working when I choose the second option. If I use the first option, I get a child but with the text in question and answer fields is empty. I need to use the first option.
Is there anything I am doing wrong?
Thanks again for everything
Kind Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您无法使用动态添加的组件的 id 属性来进行注入。我建议您保留一些可绑定变量以将值绑定到动态 FaqItem。
i don't think you will be able use the id property of the dynamically added component to do Injection. I suggest you keep some bindable variables to bind the value to the dynamic FaqItem.