如何在Flash Builder中显示另一个mxml文件的输入?

时间:2016-10-03 04:58:40

标签: flex flash-builder

如何将kuiz.mxml中的txtName显示为kuiz1.mxml? 我是编程世界的新手。谢谢你的帮助。

kuiz.mxml

<s:TextInput x="25" y="112" width="273" prompt="Name" id="txtName" restrict="a-zA-Z"/>
<s:Label id="nameU" x="88" y="175" width="145" text="{txtName.text}" />

kuiz1.mxml

<s:TextArea id="myTA" x="16" y="336" width="286" height="40" editable="false" prompt="test"/>

1 个答案:

答案 0 :(得分:0)

如果您在kuiz.mxml中有对kuiz1.mxml的引用,即

private var kuiz1Displ:kuiz1;
  1. 在kuiz1.mxml中创建一个Bindable变量,即

    [Bindable] public var textDispl:String;

  2. 将事件监听器和事件处理程序添加到文本输入,即

    s:TextInput x =&#34; 25&#34; Y =&#34; 112&#34;宽度=&#34; 273&#34;提示=&#34;名称&#34; ID =&#34; txtName的&#34;限制=&#34; - ZA-Z&#34;变化=&#34; txtName_changeHandler(事件)&#34;

    protected function txtName_changeHandler(event:TextOperationEvent):void {     kuiz1Displ.textDispl = txtName.text; }

  3. 在kuiz1中使用可绑定文本区域,即

    s:TextArea id =&#34; myTA&#34;文本=&#34; {textDispl}&#34; X =&#34; 16&#34; Y =&#34; 336&#34;宽度=&#34; 286&#34;高度=&#34; 40&#34;可编辑=#&34;假&#34;提示=&#34;测试&#34;

  4. 请记住在初始化期间将kuiz1指定给引用变量,现在当您更改txtName中的文本时,更改将反映在您的kuiz1中。

    对不起,我不得不省略开头&lt;和关闭/&gt; mxml代码中的标记,因为某些原因代码不会显示。