<?xml version="1.0" encoding="utf-8"?><mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="310" height="184" title="Login" cornerRadius="3" showCloseButton="true" close="Close()" creationComplete="Init()"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager; import mx.containers.TitleWindow; import flash.events.*; import mx.managers.PopUpManager; import mx.controls.Button; import mx.core.IFlexDisplayObject; public static var login:Login = new Login(); public static function ShowDialog(parent:DisplayObject):void { PopUpManager.addPopUp(login, parent, true); } private function Init():void{ this.x = this.parent.width / 2 - this.width / 2 ; this.y = this.parent.height / 2 - this.height / 2; } private function Close():void{ PopUpManager.removePopUp(this); } ]]> </mx:Script> <mx:Label x="10" y="38" text="User Name"/> <mx:Label x="10" y="64" text="Password"/> <mx:TextInput x="87" y="36"/> <mx:TextInput x="87" y="62"/> <mx:Label x="10" y="10" text="Please input your user name and password"/> <mx:ControlBar height="40" y="114"> <mx:Spacer width="100%"/> <mx:Button label="Login"/> <mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/> </mx:ControlBar></mx:TitleWindow> 调用 Login.ShowDialog(this); 相关文章: