Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

About loading sub-applications > Comparing loaded applications to modules - Pg. 13

USING FLEX 3.2 13 The following image shows an architecture where two applications, in separate security domains, communicate through event passing. The sub-application calls the getSandboxRoot() method to get a reference to its own SystemManager. The SystemManager can then listen for events that the main application's SystemManager dispatched. SecurityDomain 1 ApplicationDomain 1 Main_App.swf Top-level SystemManager SandboxMouseEvent systemManager.getSandboxRoot() AppDom2 (peer) Sub_App_1.swf SystemManager SecurityDomain 2 The properties of a SandboxMouseEvent object are not the same as the properties in a typical event object. For example, the target and currentTarget properties are the SandboxBridge that dispatched the event, or the SystemManager that redispatched it. These properties are not the specific object that dispatched the event. Untrusted child applications should not be able to get references to objects that are typically specified by these properties. Similarly, the stageX , stageY , localX , and localY properties are not available. For an example that uses the SandboxMouseEvent object to handle mouse events outside a sub-application's security domain, see "Listening for mouse events with sandboxed applications" on page 35. Comparing loaded applications to modules When you design a large application, give some consideration to its architecture. If the application has one main application that loads and unloads subordinate applications, then weigh the benefits of using either modules or sub- application when deciding which approach to take. Consider the example of an application composed of many forms. In a modular application, a main application loads each form as a module with the ModuleManager. In an application that uses sub-applications, each form is a separate application that the SWFLoader loads into the main application. These two approaches are similar in many ways, but also have many differences.