Core Display Classes Part2
You can load external SWFs or graphic files (JPG, PNG, and GIF) by using the Loader class. A Loader object can contain only one child display object in its display list and the display object represents the SWF or graphic file that it loads.
var l:Loader = new Loader(); l.load(new URLRequest("ext.jpg")); this.addChild(l);
The LoaderInfo class
The LoaderInfo object is a property of both the Loader object and the loaded display object. The LoaderInfo class provides infomation such as load progress, the URLs of the loader and loadee, the number of bytes total for the media, and the nominal height and width of the media.
The LoaderContext class
Use checkPolicyFile only when loading an image file. If it is true, the Loader checks the origin server for a cross-domain policy file. Security.allowDomain() gives a permission that a SWF file be loaded from other domains. When you specify securityDomain, FlashPlayer checks for the existence of a cross-domain policy file. If one exists and SWF from the domain permitted in the cross-domain policy file, it can cross-script the loaded SWF content. By putting the loaded SWF file in the same application domain using applicationDomain parameter, you can access its classes directly.
var l:Loader = new Loader(); var context:LoaderContext = new LoaderContext(); context.securityDomain = SecurityDomain.currentDomain; context.applicationDomain = ApplicationDomain.currentDomain; l.load(new URLRequest("ext.swf"), context);