Flex & PopUpManagerPlus
Posted: 28/01/11
This trivial wrapper for mx.managers.PopUpManager allows you monitor the number of active pop-ups in your Flex app, as well as a convenience method to removeAllPopUps()
package
{
import flash.display.DisplayObject;
import mx.core.IFlexDisplayObject;
import mx.core.IFlexModuleFactory;
import mx.managers.PopUpManager;
public class PopManagerPlus
{
private static var _popUps:Vector.<IFlexDisplayObject> = new Vector.<IFlexDisplayObject>();
public function PopManagerPlus()
{}
public static function removeAllPopUps() :void
{
while( _popUps.length > 0 )
{
PopUpManager.removePopUp( _popUps.pop() );
}
}
public static function addPopUp( window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean=false, childList:String=null, moduleFactory:IFlexModuleFactory=null ) :void
{
_popUps.push( window );
PopUpManager.addPopUp( window, parent, modal, childList, moduleFactory );
}
public static function removePopUp( popUp:IFlexDisplayObject ) :void
{
_popUps.splice( _popUps.indexOf( popUp ), 1 );
PopUpManager.removePopUp( popUp );
}
public static function bringToFront( popUp:IFlexDisplayObject ) :void
{
PopUpManager.bringToFront( popUp );
}
public static function centerPopUp( popUp:IFlexDisplayObject ) :void
{
PopUpManager.centerPopUp( popUp );
}
public static function get numPopUps() :int
{
return _popUps.length;
}
}
}
This code has been tested with Flex 3.2 through to Flex 4.5, running in Flash Player 10.0 and up.
Keywords for this post: flex, popupmanager, pop-up, actionscript 3, IFlexDisplayObject
Popular categories:
Recent posts:
- Mac OS find files using regex
- ADB device driver won't install
- Eclipse: An error has occurred. See the log file .metadata/.log
- Updated blinkbox iPad app
- Nexus 7 doesn't appear in adb devices list
- Improve the keyboard in the Samsung ICS update
- 403 Forbidden error on Mac web server
- Getting error with manually created NIB?
- Adding/removing items from PATH on Mac
- Presenting at Flash Oxford
- more...
Publications:
Places you'll find me:
Archive:
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023