Understanding Application Domains
Application domains are critically important in terms of how Flex applications function, but in most cases, you don’t even know they are there. An application domain is the partition within which an application runs in Flash Player. In many cases, just one application is running in Flash Player, and in such cases, there is just one application domain. However, when you load additional .swf files into an existing application, you can create additional application domains for some or all of those additional applications.
When you load a .swf file, three possible things can occur:
The loaded .swf runs in a new application domain that is completely partitioned from all other application domains.
The loaded .swf runs in a new application domain that is a child of an existing application domain.
The loaded .swf runs in an existing application domain.
Each scenario is subtly different. However, subtle differences can have a big effect, and it’s important to understand these differences so that you can understand what choices to make in each case.
All Flex and Flash applications are composed of collections of classes. An application domain holds the collections of classes for an application or applications. When just one application is running in Flash Player, the concept of an application domain is practically a formality because you are guaranteed that an .swf will never contain more than one definition for a class. However, when you load an additional .swf ...
Get Programming Flex 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.