1.API简介
Package : mx.managers
Class : PopUpManager
Methods : addPopUp(window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean = false, childList:String = null):void
参数解释:
window : 要弹出的对象,这对象必须实现了IFlexDisplayObject接口,比如TitleWindow.
parent : 子窗口的父窗口对象.
modal : 模式弹出(true)还是非模式弹出(false).
childList : 弹出式对象在那个对象下弹出.
PopUpManagerChildList.APPLICATION
PopUpManagerChildList.POPUP
PopUpManagerChildList.PARENT (默认).
2.父窗体向子窗体传值
父窗体代码
import mx.events.ListEvent;
import com.demo.PersonVO;
import mx.events.ItemClickEvent;
import mx.collections.ArrayCollection;
import mx.managers.PopUpManager;
[Bindable]
private var testDataSource : ArrayCollection = new ArrayCollection(
[ {id : 1 ,name :"zhangsan",language : "java"},
{id : 2 ,name :"lisi",language : "c++"},
{id : 3 ,name :"qianwu",language : "vb"},
{id : 4 ,name :"xiaohong",language : "pb"},
{id : 5 ,name :"xiaoming",language : "perl"},
])
private function showDetailPersonInfo(event : ListEvent) : void
{
var personVO : PersonVO =new PersonVO();
personVO.id = event.currentTarget.selectedItem.id
personVO.name = event.currentTarget.selectedItem.name;
personVO.language = event.currentTarget.selectedItem.language;
//hard code the detail person information
personVO.email = "test12638@163.com"
personVO.married = false;
personVO.workYears = "3 years"
var personPopUpWindow : PersonInfomationPopWindow = new PersonInfomationPopWindow();
personPopUpWindow.personVO = personVO;
PopUpManager.addPopUp(personPopUpWindow,this,true);
PopUpManager.centerPopUp(personPopUpWindow);
}
]]>
------------------------------
子窗体代码
xmlns:mx=""
width="400" height="300"
showCloseButton="true"
close="PopUpManager.removePopUp(this)">
import mx.managers.PopUpManager;
import com.demo.PersonVO;
[Bindable]
public var personVO : PersonVO = null;
]]>
-------------------------------------------
package com.demo
{
[Bindable]
public class PersonVO
{
public var id : String = "";
public var name : String = "";
public var language : String = "";
public var email : String = "";
public var workYears : String = "";
public var married : Boolean = false;
}
}
3.子窗体向父窗体传值
父窗体代码
xmlns:fx=""
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768">
import mx.containers.TitleWindow;
import mx.managers.PopUpManager;
import mx.controls.Text;
private var tw:titlewindow=new titlewindow();
private function mytw_click():void{
tw.owner = this;
PopUpManager.addPopUp(tw,this);
PopUpManager.centerPopUp(tw);
}
]]>
-------------------------
子窗体代码
layout="absolute"
width="498" height="368"
showCloseButton="true"
close="PopUpManager.removePopUp(this)">
import mx.controls.Alert;
import mx.managers.PopUpManager;
import mx.controls.Text;
private function btn_click():void{
//dispatchEvent(new Event("tw_click"));
var a:PopUpDemo_1 = this.owner as PopUpDemo_1;
a.tit_usr.text = this.tw_usr.text;
a.tit_psw.text = this.tw_psw.text;
PopUpManager.removePopUp(this);
}
]]>
阅读(4545) | 评论(2) | 转发(0) |