Labels

Saturday, November 7, 2009

Popups in Flex using PureMVC

I was searching for the issue of how to use popups in flex using PureMVC.

I ultimately stumbled upon the following blog which I thought will be very useful for this purpose.

http://www.newtriks.com/?p=76

Listen to Events dispatched from flex Pop-ups.

  • When sending events from your pop-up window, remember that they aren’t dispatched in exactly the same manner as with other components.
  • In general, events work much as you would expect, with one variation: events from pop-ups don’t travel down the inheritance chain to the main application root.
  • Instead, events dispatched from pop-up windows are terminated at the window root.
  • This is because the pop-up manager is the parent of the pop-up window.
  • As a result, events launched in the pop-up don’t bubble up to the main application page, which is the eventual parent of any object in the main application.
  • Popups within a Flex application are not children of the application container, but are instead children of the SystemManger.
  • I can instead attach my listener to:
    Application.application.systemManager

    Then my listener will hear all bubbling events within the system, regardless of whether they originate within a Popup or a standard UIComponent.