Enter your email address:

    Delivered by FeedBurner

Tuesday, September 22, 2009

Flex: Call Pop-up Window on Flex

Steps on how to add a pop-up window on Flex:

1.  Create a new component, then choose a component type on based on.  Choosing a TitleWindow would be perfect for a pop-up window.  Then save.  (on this sample, it's saved as mypopup)

2.  To call the pop-up, add the following code.


var sScreen:IFlexDisplayObject = PopUpManager.createPopUp(this, mypopup, true);
PopUpManager.centerPopUp(sScreen);

The code would simply call the pop-up mypopup. The pop-up is centered on the component that called it, represented by this.  The pop-up's modality is set to true, meaning the main application is disabled until the pop-up closes.



if you wish to center the pop-up window on the application, instead of the one that called it, change this to UIComponent(this.parentApplication)

example:
var Screen:IFlexDisplayObject = PopUpManager.createPopUp(UIComponent(this.parentApplication), mypopup, true);

You would need to add import mx.core.UIComponent; on your code to.


3. Code to close the pop-up.

PopUpManager.removePopUp(this);   

0 comments:

Post a Comment

About Me

My photo
I provide health supplements, adult wellness products, glutathione, and other merchandise. Please visit my online shop at: http://luckycowshop.blogspot.com/