Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

ActionScript 3.0 Documentation Hole: LoaderInfo SecurityErrorEvent

Posted November 11, 2010 by senocular

As mentioned in the recent Security Domains, Application Domains, and More in ActionScript 3.0 tutorial, you have the ability to load SWFs from another domain into your own SWF's security domain when using the Loader class. What wasn't covered was error handling, or specifically, what happens when this fails. In fact, I'll tell you now: a SecurityErrorEvent.SECURITY_ERROR event occurs. This gets dispatched from the Loader's contentLoaderInfo object (a LoaderInfo instance) when a cross-domain policy file does not allow, or does not exist to allow the loading of a cross-domain SWF into the security domain of your SWF. Currently (at least at the time of this writing), however, this is not documented in the AS3 language reference.

So, the next time you add listeners to your LoaderInfo, to be completely covered, make sure you also include one for SecurityErrorEvent.SECURITY_ERROR (though this would only be likely ever to occur if you were messing with security domains which is an unlikely case, nevertheless, you've been warned).