【发布时间】:2014-03-21 08:46:57
【问题描述】:
我在 Flex 中有一个 Accordion 组件,它有两个子组件, 在我的页面加载时,我想通过使用动作脚本将第一个孩子中的文本字段的文本值提供给第二个孩子中的文本字段,但它失败了
nb : 当我单击第二个子代并返回以传递第一个子代的 textvalue 时,操作成功!
<mx:HBox width="100%" height="310" horizontalAlign="center">
<mx:Accordion id="accordion1" width="100%" height="310" historyManagementEnabled="true">
<!-- child 1--><mx:VBox id="theme_resultat" width="95%" height="95%"
label="Résultat" horizontalAlign="center"
verticalAlign="middle">
<s:HGroup left="0" right="0" bottom="0" width="98%"
horizontalAlign="right">
<s:TextInput id="doc"/>
<mx:Button id="btnAdd" label="Add"
click="add_text(event)"
icon="@Embed('assets/images/add.png')"
paddingLeft="3" paddingRight="3"/>
</s:HGroup>
</mx:VBox>
<!-- child 2--><mx:VBox id="theme_detail" width="95%" height="95%" label="Détail"
verticalAlign="middle">
<mx:VBox width="100%" height="150" horizontalAlign="center">
<s:HGroup>
<mx:FormItem label="Titre:" paddingLeft="5">
<mx:TextInput id="doc_titre"/>
</mx:FormItem>
</s:HGroup>
</mx:VBox>
</mx:VBox>
</mx:Accordion>
</mx:HBox>
protected function add_text(event:MouseEvent):void { accordion1.selectedIndex=1; doc_titre.text = doc.text; } }
当我点击添加时,我移动到第二个孩子,但 (mx:TextInput id="doc_titre") 没有 (s:TextInput id="doc"/) 的值
我第二次返回子 1 并单击添加,然后移动到第二个子并在 (mx:TextInput id="doc_titre) 中找到 (s:TextInput id="doc") 的值")
【问题讨论】:
-
您是否收到任何错误/异常/警告?
-
不,我错过了creationPolicy = all,谢谢
标签: actionscript-3 apache-flex accordion