flash flex 弹出窗口并交互数据
主窗口layout.mxml<?xmlversion="1.0"encoding="utf-8"?><s:Applicationxmlns:fx="http://ns.a...
主窗口 layout.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import flash.geom.Point;
import mx.collections.ArrayCollection;
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.core.IFlexDisplayObject;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
import org.osmf.layout.AbsoluteLayoutFacet;
import spark.components.TitleWindow;
[Bindable]
private var employees:ArrayCollection=new ArrayCollection
([{name:'测试员003',phone:'管理员',email:'',ck:'',wh:'人员分配'},
{name:'测试员001',phone:'管理员',email:'',ck:'',wh:'人员分配'}
]);
protected function init():void
{
}
public function clickEvent():void{
PopUpManager.centerPopUp();
}
]]>
</fx:Script>
<mx:LinkButton label="{data.wh}" textDecoration="underline" fontWeight="normal" color="0x3380DD" click="outerDocument.clickEvent()"/>
</s:Application>
子窗口 child.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="100%" height="100%"
title="Add A Note">
<mx:Metadata>
[Event(name="SaveNote")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.collections.ArrayCollection;
[Bindable]
public var cards:ArrayCollection = new ArrayCollection(
[ {label:"Visa", data:1},
{label:"MasterCard", data:2},
{label:"American Express", data:3} ]);
private function close():void
{
PopUpManager.removePopUp(this);
}
private function save():void
{
this.dispatchEvent(new Event("SaveNote"));
}
]]>
</mx:Script>
<mx:Label text="营业执照上传" x="45" y="8"/>
<mx:LinkButton label="上传文件" textDecoration="underline" fontWeight="normal" color="0x3380DD" x="157" y="7"/>
<mx:Label text="营业执照注册号" x="33" y="44"/>
<mx:Label text="企业名称" x="69" y="73"/>
<mx:TextInput id="author" x="130" y="42" width="607"/>
<mx:TextInput id="authors" x="130" y="71" width="608"/>
<mx:Label text="成立日期" x="65" y="119"/>
</mx:TitleWindow> 展开
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import flash.geom.Point;
import mx.collections.ArrayCollection;
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.core.IFlexDisplayObject;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
import org.osmf.layout.AbsoluteLayoutFacet;
import spark.components.TitleWindow;
[Bindable]
private var employees:ArrayCollection=new ArrayCollection
([{name:'测试员003',phone:'管理员',email:'',ck:'',wh:'人员分配'},
{name:'测试员001',phone:'管理员',email:'',ck:'',wh:'人员分配'}
]);
protected function init():void
{
}
public function clickEvent():void{
PopUpManager.centerPopUp();
}
]]>
</fx:Script>
<mx:LinkButton label="{data.wh}" textDecoration="underline" fontWeight="normal" color="0x3380DD" click="outerDocument.clickEvent()"/>
</s:Application>
子窗口 child.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="100%" height="100%"
title="Add A Note">
<mx:Metadata>
[Event(name="SaveNote")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.collections.ArrayCollection;
[Bindable]
public var cards:ArrayCollection = new ArrayCollection(
[ {label:"Visa", data:1},
{label:"MasterCard", data:2},
{label:"American Express", data:3} ]);
private function close():void
{
PopUpManager.removePopUp(this);
}
private function save():void
{
this.dispatchEvent(new Event("SaveNote"));
}
]]>
</mx:Script>
<mx:Label text="营业执照上传" x="45" y="8"/>
<mx:LinkButton label="上传文件" textDecoration="underline" fontWeight="normal" color="0x3380DD" x="157" y="7"/>
<mx:Label text="营业执照注册号" x="33" y="44"/>
<mx:Label text="企业名称" x="69" y="73"/>
<mx:TextInput id="author" x="130" y="42" width="607"/>
<mx:TextInput id="authors" x="130" y="71" width="608"/>
<mx:Label text="成立日期" x="65" y="119"/>
</mx:TitleWindow> 展开
1个回答
展开全部
主窗口去实例化一个 子窗口,然后用popupmanager 弹出就可以了。用实例名去访问子窗口的数据
追问
public function clickEvent():void{
vl.user=cards;
PopUpManager.addPopUp(vl,this,true);
}
public function set user(value:ArrayCollection):void
{
_user = value;
}数据交互该如何?谢谢
追答
你这代码里不是已经把数据传递给子窗口了么?
如果主窗口要访问子窗口的数据的话,那就在子窗口公开一个 getter,主窗口用代码 vl. 属性 来访问呗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询