五月综合缴情婷婷六月,色94色欧美sute亚洲线路二,日韩制服国产精品一区,色噜噜一区二区三区,香港三级午夜理伦三级三

您現(xiàn)在的位置: 365建站網(wǎng) > 365文章 > flex TitleWindow之間數(shù)據(jù)傳輸?shù)氖纠?/div>

flex TitleWindow之間數(shù)據(jù)傳輸?shù)氖纠?/h1>
文章來源:365jz.com     點(diǎn)擊數(shù):602    更新時(shí)間:2009-12-02 21:16   參與評論

在Flex里,一般的彈出窗口(除了Alert以外)都可以用TitleWindow組件完成,主窗口和TitleWindow的數(shù)據(jù)傳輸可以用以下方法:
假設(shè)TitleWindow的實(shí)例文件為titleWin.mxml,則要在Application中用PopUpManager創(chuàng)建一個(gè)titleWin的引用
private var popWin:titleWin = titleWin(PopUpManager.createPopUp(this,titleWin,true));
如果要將Application的一個(gè)組件的值傳給titleWin,如Application的id="userName"的TextInput的值傳給titleWin,必須先在titleWin.mxml里聲明一個(gè)TextInput的組件:
public var userNameInPop:TextInput;
然后在Application里:
popWin.userNameInPop=userName;
這樣就相當(dāng)于把Application的userName的TextInput組件傳給了titleWin,可以在titleWin.mxml里綁定這個(gè)值然后在文本框里顯示出來:
[Bindable]
public var userNameInPop:TextInput;

<mx:TextInput x="110" y="39" id="popUserName" text="{userNameInPop.text}"/>



而要把titleWin的值傳給Application則只需在titleWin.mxml里把TextInput的值賦給userNameInPop的text即可:
userNameInPop.text=popUserName.text;

全部代碼如下:
titleWin.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" showCloseButton="true" close="PopUpManager.removePopUp(this)">
    <mx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            //[Bindable]
            //public var userName:TextInput;
            [Bindable]
            public var userNameInPop:TextInput;
            [Bindable]
            public var userEmailInPop:TextInput;
            private function showText():void
            {
                userNameInPop.text=popUserName.text;
                userEmailInPop.text=popEmail.text;
                PopUpManager.removePopUp(this);
            }
        ]]>
    </mx:Script>
    <mx:Label text="用戶名:" x="57" y="41"/><mx:TextInput x="110" y="39" id="popUserName" text="{userNameInPop.text}"/>
    <mx:Label text="郵箱:" x="57" y="71"/><mx:TextInput x="110" y="69" id="popEmail" text="{userEmailInPop.text}"/>
    <mx:Button x="157" y="99" label="Button" click="showText()"/>
   
</mx:TitleWindow>

mainWindow.mxml
<?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 function pop():void
            {
                var popWin:titleWin = titleWin(PopUpManager.createPopUp(this,titleWin,true));
                popWin.title="彈出窗口";
                popWin.userNameInPop=userName;
                popWin.userEmailInPop=email;
            }
        ]]>
    </mx:Script>
    <mx:Label text="用戶名:" x="106" y="95"/><mx:TextInput x="159" y="91" id="userName" text="ssz413"/>
    <mx:Label text="郵箱:" x="106" y="144"/><mx:TextInput x="159" y="142" id="email" text="ssz425"/>
    <mx:Button x="207" y="189" label="Button" click="pop()"/>
   
</mx:Application>

如對本文有疑問,請?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會(huì)為你解答!! 點(diǎn)擊進(jìn)入論壇

發(fā)表評論 (602人查看,0條評論)
請自覺遵守互聯(lián)網(wǎng)相關(guān)的政策法規(guī),嚴(yán)禁發(fā)布色情、暴力、反動(dòng)的言論。
昵稱:
最新評論
------分隔線----------------------------

其它欄目

· 建站教程
· 365學(xué)習(xí)

業(yè)務(wù)咨詢

· 技術(shù)支持
· 服務(wù)時(shí)間:9:00-18:00
365建站網(wǎng)二維碼

Powered by 365建站網(wǎng) RSS地圖 HTML地圖

copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號(hào)