Popup window is used when You need to display certain action over your main application.
while using popup window all you need a Display Control that must be of type TitleWindow, otherwise you need to type cast it.
from your main application
create a instance of PopUpManager
Add your Display object in it.
While Adding your Display Object PopupManger Accept Three parameter
PopUpManager.addPopUp(window:iDisplayObject,parentObject,Model)
window:iDisplayObject : Your Window need to PopUp
parentObject : Parent Which hold This PopUp
Model : If true backgroung Application is not accessible, if false accessible
Here You get your window code.
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="400" height="222"
title="Popup Window Example."
showEffect="{wD}" hideEffect="{wU}" visible="false" creationComplete="titlewindow1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import flashx.textLayout.factory.TruncationOptions;
import mx.events.FlexEvent;
protected function button1_clickHandler(event:MouseEvent):void
{
this.visible = false;
}
protected function titlewindow1_creationCompleteHandler(event:FlexEvent):void
{
this.visible = true;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<mx:WipeDown duration="500" id="wD"/>
<mx:WipeUp duration="500" id="wU"/>
</fx:Declarations>
<mx:Button x="120" y="152" label="Ok" click="button1_clickHandler(event)"/>
<mx:Label x="9" y="21" text="Old Password" width="91"/>
<mx:Label x="10" y="62" text="New Password" width="90"/>
<mx:Label x="12" y="97" text="Confirm" width="100"/>
<mx:TextInput x="119" y="20"/>
<mx:TextInput x="119" y="60"/>
<mx:TextInput x="120" y="97"/>
</mx:TitleWindow>
Main App Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" minWidth="500" minHeight="500" width="569" height="374">
<fx:Script>
<![CDATA[
import examples.PopUpWin;
import mx.containers.TitleWindow;
import mx.managers.PopUpManager;
protected function button1_clickHandler(event:MouseEvent):void
{
var _disPlayObj:PopUpWin = new PopUpWin;
PopUpManager.addPopUp(_disPlayObj,this,true);
PopUpManager.centerPopUp(_disPlayObj);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Button x="235" y="183" label="Change Password" width="100" click="button1_clickHandler(event)"/>
</mx:Application>
Example
while using popup window all you need a Display Control that must be of type TitleWindow, otherwise you need to type cast it.
from your main application
create a instance of PopUpManager
Add your Display object in it.
While Adding your Display Object PopupManger Accept Three parameter
PopUpManager.addPopUp(window:iDisplayObject,parentObject,Model)
window:iDisplayObject : Your Window need to PopUp
parentObject : Parent Which hold This PopUp
Model : If true backgroung Application is not accessible, if false accessible
Here You get your window code.
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="400" height="222"
title="Popup Window Example."
showEffect="{wD}" hideEffect="{wU}" visible="false" creationComplete="titlewindow1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import flashx.textLayout.factory.TruncationOptions;
import mx.events.FlexEvent;
protected function button1_clickHandler(event:MouseEvent):void
{
this.visible = false;
}
protected function titlewindow1_creationCompleteHandler(event:FlexEvent):void
{
this.visible = true;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<mx:WipeDown duration="500" id="wD"/>
<mx:WipeUp duration="500" id="wU"/>
</fx:Declarations>
<mx:Button x="120" y="152" label="Ok" click="button1_clickHandler(event)"/>
<mx:Label x="9" y="21" text="Old Password" width="91"/>
<mx:Label x="10" y="62" text="New Password" width="90"/>
<mx:Label x="12" y="97" text="Confirm" width="100"/>
<mx:TextInput x="119" y="20"/>
<mx:TextInput x="119" y="60"/>
<mx:TextInput x="120" y="97"/>
</mx:TitleWindow>
Main App Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" minWidth="500" minHeight="500" width="569" height="374">
<fx:Script>
<![CDATA[
import examples.PopUpWin;
import mx.containers.TitleWindow;
import mx.managers.PopUpManager;
protected function button1_clickHandler(event:MouseEvent):void
{
var _disPlayObj:PopUpWin = new PopUpWin;
PopUpManager.addPopUp(_disPlayObj,this,true);
PopUpManager.centerPopUp(_disPlayObj);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Button x="235" y="183" label="Change Password" width="100" click="button1_clickHandler(event)"/>
</mx:Application>
Example
No comments:
Post a Comment