0 Replies Latest reply on Mar 29, 2011 3:18 PM by boneitis

    SWF Loader not dispatching IO/SecurityErrorEvents


      Hello, I am currently fixing an existing application at my company. This app is in a flex 4.0 and loads in (and subsequently unloads) SWFs and Modules (which vary from Flex apps to FLA based apps). Currently the following code exists:


                          var swfLoader:SWFLoader = new SWFLoader();
                          var ldrContext:LoaderContext = new LoaderContext( true, new ApplicationDomain( ApplicationDomain.currentDomain ) );
                          swfLoader.loaderContext = ldrContext;
                          swfLoader.loadForCompatibility = true;
                          swfLoader.trustContent = true;
                          swfLoader.addEventListener( HTTPStatusEvent.HTTP_STATUS, handleStatus );
                          swfLoader.addEventListener( IOErrorEvent.IO_ERROR, handleIOError );
                          swfLoader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, handleSecurityError );
                          swfLoader.addEventListener( Event.COMPLETE, handleLoadComplete );
                          swfLoader.addEventListener( ProgressEvent.PROGRESS, handleProgress );
                          swfLoader.autoLoad = true;
                          swfLoader.load( "someBrokenSWF" );
                          swfLoader.width = 930;
                          swfLoader.height = 575;
      //                    cont.addChild( swfLoader );
                     public function handleLoadComplete( _event:Event):void{
                          trace(" in handleLoadComplete"  );
                     public function handleStatus( _event:HTTPStatusEvent):void{
                          trace(" in handleStatus" + _event.status );
                     public function handleProgress( _event:ProgressEvent ):void{
                          trace(" in handleProgress");
                     public function handleIOError( _event:IOErrorEvent ):void{
                          trace(" in handleIOError");
                     public function handleSecurityError( _event:IOErrorEvent ):void{
                          trace(" in handleSecurityError");


      When I load a SWF that is proper, i go to the load complete (great success).


      However, when I load a SWF that 404s i get 2 progress events, then nothing.  No status, no IO/Security error, nothing.  When I rip this out of the bohemith application where it currently resides, and place it in a basic application, everything works properly.


      Has anyone seen this before?


      A few other facts:

      All the SWFs live on the same domain, and same folder

      I am _positive_ the var 'swfLoader' is not being over written, nor are the listeners being removed

      I have tried it with the loader on and off the stage/visible

      When it 404's the COMPLETE event is not dispatched either.

      When i force a security error, I get the same.


      I can't think of any reason why this would happen and would really appreciate some suggestions.  Thanks.