Using error event when loading Module
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import mx.events.ModuleEvent; import mx.modules.*; import mx.controls.Alert; private function errorHandler(e:ModuleEvent):void { Alert.show("error loading."+ e.errorText); } public function createModule():void { chartModuleLoader.url = "a.swf"; chartModuleLoader.loadModule(); } public function removeModule():void { chartModuleLoader.unloadModule(); } </mx:Script> <mx:Panel title="Module Example" height="90%" width="90%"> <mx:HBox> <mx:Button label="Load" click="createModule()" /> <mx:Button label="Unload" click="removeModule()" /> </mx:HBox> <mx:ModuleLoader id="chartModuleLoader" error="errorHandler(event)" /> </mx:Panel> </mx:Application>