flex弹出窗口

titleWindowApp.mxml

<?xml version="1.0" encoding="utf-8"?>
<!-- Main application to demonstrate TitleWindow layout container. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" fontSize="14" backgroundColor="#000000">
    <mx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            import mx.containers.TitleWindow;
            import flash.geom.Point;
            private var point1:Point = new Point();
            private function showWindow():void {
                var login:SimpleTitleWindowExample=SimpleTitleWindowExample(PopUpManager.createPopUp( this, SimpleTitleWindowExample , true));
                point1.x=myButton.x;
                point1.y=myButton.y;
                point1=myButton.localToGlobal(point1);
                login.x=point1.x+25;
                login.y=point1.y+25;
                login.loginName=returnedName;
            }
        ]]>
    </mx:Script>
    <mx:Panel title="TitleWindow Container Example" height="75%" width="75%"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
        <mx:Button id="myButton" label="Click to open the TitleWindow container"
            click="showWindow();"/>
        <mx:Text id="returnedName" text="" width="100%"/>
    </mx:Panel>
</mx:Application>

SimpleTitleWindowExample.mxml

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple custom MXML TitleWindow component.
     The TitleWindowApp application displays this component.
     You cannot run it independently. -->
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
    title="Title Window" x="168" y="86" fontSize="14">
    <mx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            import mx.controls.Text;
            public var loginName:Text;
            private function returnName():void {
                loginName.text="Name entered: " + userName.text;
                PopUpManager.removePopUp(this);
            }
        ]]>
    </mx:Script>
    <mx:Glow id="dissolve" color="#FF0000" blurXFrom="10" blurXTo="100" duration="3000" />
    <mx:HBox>
        <mx:Label text="Enter Name: "/>
        <mx:TextInput id="userName" width="100%"/>
    </mx:HBox>
    <mx:HBox>
        <mx:Button id="oklabel" label="OK" rollOverEffect="dissolve" click="returnName();"/>
        <mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/>
    </mx:HBox>
    <mx:Image source="http://pic.nipic.com/2008-05-06/20085661157167_2.jpg"  width="802" height="603" x="17.85" y="10"/>
</mx:TitleWindow>

    A+
发布日期:2009年05月19日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: