加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

使用弹出窗体修改数据,之后返回值

发布时间:2020-12-15 01:36:00 所属栏目:百科 来源:网络整理
导读:? 初次使用Flex,希望在程序中能使用弹出窗口的类型,就是有A、B两个窗体,B从A中弹出,并显示A中的指定数据且可修改,修改完成后的数据更新到A中: A窗体: ? xml?version = " 1.0 " ?encoding = " utf-8 " ? mx:Application?xmlns:mx = " http://www.adobe.c

?

初次使用Flex,希望在程序中能使用弹出窗口的类型,就是有A、B两个窗体,B从A中弹出,并显示A中的指定数据且可修改,修改完成后的数据更新到A中:

A窗体:

<? xml?version = " 1.0 " ?encoding = " utf-8 " ?>
< mx:Application?xmlns:mx = " http://www.adobe.com/2006/mxml " ?layout = " absolute " >
????
< mx:Script >
????????
<! [CDATA[
????????????
import ?mx.managers.PopUpManager;
????????????
private ?var?_win1:win1? = ? new ?win1();
????????????
private ?function?showWin1(): void {
????????????????_win1.s_tmp?
= ? this .p_txt.text;
????????????????PopUpManager.addPopUp(_win1,?
this ,? true );
????????????????PopUpManager.centerPopUp(_win1);
????????????????_win1.addEventListener(
" t1 " ,?update);
????????????}
????????????
private ?function?update(evt:Event): void {
????????????????
this .p_txt.text? = ?_win1.s_tmp;
????????????????PopUpManager.removePopUp(_win1);
????????????}
????????]]
>
????
</ mx:Script >
????
< mx:TextInput?x = " 333 " ?y = " 129 " ?id = " p_txt " />
????
< mx:Button?x = " 380 " ?y = " 159 " ?label = " Button " ?click = " showWin1(); " />
????
</ mx:Application >

?

B窗体:

<? xml?version = " 1.0 " ?encoding = " utf-8 " ?>
< mx:TitleWindow?xmlns:mx = " http://www.adobe.com/2006/mxml " ?layout = " absolute " ?width = " 400 " ?height = " 300 " >
????
< mx:Script >
????????
<! [CDATA[
????????????
import ?mx.managers.PopUpManager;
????????????[Bindable]
????????????
public ?var?s_tmp:String;
????????????
????????????
private ?function?click_return(): void {
????????????????s_tmp?
= ? this .c_txt.text;???????? // 必须,绑定只是在此值改变的时候在Text中更新,但Text更新时绑定变量的值却不会自动改变
????????????????dispatchEvent( new ?Event( " t1 " ));???? // 手动触发事件
????????????}
????????]]
>
????
</ mx:Script >
????
< mx:TextInput?x = " 110 " ?y = " 82 " ?id = " c_txt " ?text = " {s_tmp} " />
????
< mx:Button?x = " 157 " ?y = " 112 " ?label = " Button " ?click = " click_return(); " />
</ mx:TitleWindow >

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读