Loading an SWF and getting components from its library

Keeping all assets in one SWF causes problems while updating assests and compiling times are longer. Nowadays only crazy people add everything into a one SWF and the Flash platform has improved a lot to support alternative ways to embed, load and add assets.

The flash.utils.getDefinitionByName allows to load assets from the library of another SWF-file. I’ve simplified the process in my Utils.as and here is an example how to use it.

Main thing is to use the ApplicationDomain to keep the loaded SWF in its own domain. ApplicationDomain allows multiple definitions of the same class to exist and allow children to reuse parent definitions.
Jatka lukemista ”Loading an SWF and getting components from its library”