Skip to Main Content
Professional Cairngorm™
book

Professional Cairngorm™

by Jeremy Wischusen
November 2009
Intermediate to advanced content levelIntermediate to advanced
357 pages
8h 20m
English
Wrox
Content preview from Professional Cairngorm™

18.7. Implementation and Testing

Since the logic for what needs to occur when the application first loads has been moved to an event and command class, you are going to have to make some modifications to the MainView component to trigger the ApplicationInitializationEvent. While we are in there making modifications, we're going to make a few others regarding how views are being constructed to make the design more modular and organized.

If you continued simply adding views to the main view, this file could potentially get quite large. Part of the reason for using views is that you can, ideally, arrange them so that each view contains only the code to make that view operate. This keeps your view files simple and easy to deal with and also has the added benefit of making code related to specific views easy to find and update.

In order to keep the MainView component from getting too large, you are going to reorganize it by splitting it up into multiple views, which in turn will be made up of other views. Thus the MainView simply acts as a container that holds the sub-views. Adding another main view will simply be a matter of creating the sub-view component and adding it to the MainView as a direct child of the ViewStack component, and adding constants to the ChangeMainViewEvent to represent the new main view.

First you are going to address the new method of handling application initialization. Edit the init function of the MainView to match the following:

private function init():void{ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional Java® JDK®, 6th Edition

Professional Java® JDK®, 6th Edition

W. Clay Richardson, Jeff Scanlon, Donald Avondolio, Mark W. Mitchell, Scot Schrager

Publisher Resources

ISBN: 9780470497265Purchase book