Real Actors: Loader and URLLoader

So far this chapter has touched briefly on the Image, StyleManager, and ModuleManager classes, and equally briefly used ModuleManager. To further your understanding of the modularization techniques, you need to be aware of two important connections:

  • The Image class is a descendant of SWFLoader, the Flex component that facilitates loading of SWF files in addition to images, such as JPEG and GIF.

  • Both SWFLoader and ModuleManager delegate the actual loading to flash.display.Loader.

As the saying goes, all roads lead to Rome, and for your purposes Rome is flash.display.Loader. Be it SWFLoader, ModuleManager, StyleManager (or the similar ResourceManager), modularization is all about loading and unloading classes via flash.display.Loader, the only Flash component that creates class definitions and class instances from the remote URL. In addition, flash.display.Loader can create classes from the existing byte code, for instance, the byte code obtained with the help of flash.net.URLLoader (as illustrated in Example 7-1).

Get Agile Enterprise Application Development with Flex 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.