FLEX实践:PopUpManager使用

本例将实现弹出窗口的两种方式

1、PopUpManager.createPopUp

2、PopUpManager.addPopUp

1)创建FunctionSearchComponent.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="390" height="270">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.*;
private function query():void{
Alert.show("Search Functino!");
}
private function newSearch():void{
functionCode.text="";
moduleId.text="";
}
private function cancel():void{
PopUpManager.removePopUp(this);
}
]]>
</mx:Script>
<mx:Label x="10" y="81" text="Function Code:" />
<mx:Label x="56" y="107" text="Module:" />
<mx:TextInput x="119" y="79" width="253" id="functionCode"/>
<mx:TextInput x="119" y="105" width="253" id="moduleId"/>
<mx:Button x="181" y="176" label="New" click="newSearch()"/>
<mx:Button x="239" y="176" label="Find" click="query()"/>
<mx:Button x="297" y="176" label="Cancel" click="cancel()"/>

</mx:Canvas>

2)创建应用程序 FunctionForm.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>
<![CDATA[


private function search():void{
var functionSearchWin:FunctionSearchComponent=

FunctionSearchComponent(PopUpManager.createPopUp(this,FunctionSearchComponent,false));

functionSearchWin.x=150;
functionSearchWin.y=150;
}

private function search1():void{
var functionSearchWin:FunctionSearchComponent=new FunctionSearchComponent()


functionSearchWin.width=400;
functionSearchWin.height=400;
functionSearchWin.x=150;
functionSearchWin.y=150;
PopUpManager.addPopUp(functionSearchWin,this,true);
}

]]>
</mx:Script>

<mx:Button label="search" id="save" click="search()"/>

<mx:Button label="search1" id="save" click="search1()"/>

</mx:Application>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值