In PopUpWindow you just have to add a new static function:
public static function createPopUp():void
{
var popUp:PopUpWindow = new PopUpWindow();
PopUpManager.addPopUp(popUp, FlexGlobals.topLevelApplication as DisplayObject, true);
PopUpManager.centerPopUp(popUp);
}
This would be something like pseudo-contructor for PopUpWIndow. Now in your main app you can invoke a pop up window just like that:
PopUpWindow.createPopUp();
This will create a pop up that is always centered in the main app. If you want to center your window on a any DisplayObject, you can change slightly above function:
public static function createPopUp(displayObject:DisplayObject):void
{
var popUp:PopUpWindow = new PopUpWindow();
PopUpManager.addPopUp(popUp, displayObject, true);
PopUpManager.centerPopUp(popUp);
}
This function works almost like a contructor, so you can make some calculations in it or just pass data to pop up window.
No comments:
Post a Comment