Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 2nd, 2013  |  syntax: None  |  size: 1.71 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public function show(realParent:Sprite,
  2.                      displayParent:Sprite = null,
  3.                      closeHandler:Function = null,
  4.                      moduleFactory:IFlexModuleFactory = null):Dialog {
  5.  
  6.     // Get the parent ...
  7.     // If none is set, use the top-level-application.
  8.     if (!displayParent) {
  9.         var sm:ISystemManager = ISystemManager(FlexGlobals.topLevelApplication.systemManager);
  10.         // no types so no dependencies
  11.         var mp:Object = sm.getImplementation("mx.managers.IMarshallPlanSystemManager");
  12.         if (mp && mp.useSWFBridge())
  13.             displayParent = Sprite(sm.getSandboxRoot());
  14.         else
  15.             displayParent = Sprite(FlexGlobals.topLevelApplication);
  16.     }
  17.  
  18.     // Register for close-events, making sure the pop-up is closed.
  19.     if (closeHandler != null) {
  20.         this.addEventListener(CloseEvent.CLOSE, closeHandler);
  21.     }
  22.  
  23.     // Setting a module factory allows the correct embedded font to be found.
  24.     if (moduleFactory) {
  25.         this.moduleFactory = moduleFactory;
  26.     } else if (realParent is IFlexModule) {
  27.         this.moduleFactory = IFlexModule(realParent).moduleFactory;
  28.     } else {
  29.         if (realParent is IFlexModuleFactory) {
  30.             this.moduleFactory = IFlexModuleFactory(realParent);
  31.         } else {
  32.             this.moduleFactory = FlexGlobals.topLevelApplication.moduleFactory;
  33.         }
  34.  
  35.         // also set document if parent isn't a UIComponent
  36.         if (!parent is UIComponent) {
  37.             this.document = FlexGlobals.topLevelApplication.document;
  38.         }
  39.     }
  40.  
  41.     // Make the dialog center itself relative to the parent.
  42.     PopUpManager.addPopUp(this, displayParent, true);
  43.     PopUpManager.centerPopUp(this);
  44.  
  45.     return this;
  46. }