1. 父画面传值给popup画面
在popup画面定义全局变量
public var objData:Object;
父画面调用:
var obj:Object = this.objTemp;
var item:Test_Popup = new Test_Popup();
item.objData = obj;
PopUpManager.addPopUp(item, this, true);
PopUpManager.centerPopUp(item);
这样在popup画面就可以得到父画面的数据了。
2.popup 画面传值给父画面
自定义一个事件
package
{
import flash.events.Event;
public class ChangeEvent extends Event
{
private var strText:String;
private var obj:Object;
public function ChangeEvent(strName:String)
{
super(strName);
}
public function set setText(str:String):void {
this.strText = str;
}
public function get getText():String {
return this.strText;
}
public function set setObject(obj:Object):void {
this.obj = obj;
}
public function get getObject():Object {
return this.obj;
}
}
}
父画面调用
private function fncClick(evt:MouseEvent):void {
var item:pop = new pop();
item.addEventListener("TESTEVENT", drawRact);
PopUpManager.addPopUp(item, this, true);
PopUpManager.centerPopUp(item);
}
private function drawRact(evt:ChangeEvent):void {
var obj:Object = evt.getObject;
}
popup画面
private function fncOK():void {
var evt:ChangeEvent = new ChangeEvent("DRAWRACT");
var obj:Object = new Object();
obj.loop = Number(this.txtLen.text);
obj.devide = Number(this.txtDevide.text);
obj.start = Number(this.txtStart.text);
obj.end = Number(this.txtEnd.text);
evt.setObject = obj;
this.dispatchEvent(evt);
this.parent.removeChild(this);
}