O'Reilly logo

ActionScript Developer's Guide to PureMVC by Cliff Hall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Advanced View Topics

Much of your application’s user interface may already be created by the time the PureMVC apparatus is initialized, and is therefore ready for mediation at startup. But there many situations that do not fit this easy approach. We will look at the major categories of problematic View Component life cycles in this chapter.

Managing Pop Ups

So far in the book, we have only covered mediation and interaction with View Components that are in the display list by way of the main application declaring a few top-level components, which in turn declare other components, and so forth. In the case of StoryArchitect, the application and its two top-level components are mediated easily in the PrepareViewCommand and receive Events from all the subcomponents within.

However, the application also makes use of some pop ups, which require an inherently different mediation strategy. They are transient objects that are displayed and removed randomly throughout runtime. In Flex, the PopUpManager Singleton is used to manage the display, centering, and removal of pop ups. If you want to center the pop up over the application, you have to pass in a reference to the application itself, which traditionally was accessed from another Flex Singleton, Application.application. However that has been deprecated in favor of FlexGlobals.topLevelApplication. So if you have been working on a really large application where pop ups are created frequently throughout, you may see lots of warnings ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required