SWF SecurityError: error # 2000: no active security context

Hi. I have a flash image gallery that worked fine until a few days later stopped loading images. the debugger throws this error:

SecurityError: Error #2000: No active security context. 

can someone explain what could be causing?

+2
source share
6 answers

Have your image extensions changed, possibly from .jpg to .JPG or something like that?

This is usually caused if there is a problem with your external media. Here is a workaround for him, but I usually try and decide that he should leave.

 setTimeout( function():void{fileReference.load();}, 1); 

Hope this helps.

+2
source

I ran into this problem when working with image loading, where the path is in an external XML file. So ... I load the XML to get the path from it, but then the problem was I was loading 30 + images, and the error only appeared 6 times like that .. I had no idea which file locations were bad.

If you want the flash to output more information than just:

 SecurityError: Error #2000: No active security context. 

Add an event listener to your bootloader:

 loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); 

and finally this function:

 protected function ioErrorHandler(e:IOErrorEvent):void{ trace(e.text); } 

In this case, your security error is converted to a URL Not Found Error with the file you specified. Based on this information, it will be easier for you to debug the problem.

 Error #2035: URL Not Found. URL: file:////Volumes/Macintosh%20HD/Users/cleanshooter/Documents/Website%20/here/there/everywhere/30805/filename.jpg 
+4
source

I encountered this problem before, the final output was due to the wrong image path or name

+3
source

I ran into this problem and used the above setTimeout example, but in a slightly different way. I called a php script that got on Twitter and got the same security issue in the Flash debug player. I just wanted to add my example, which is based on the above, to show how you can use this "workaround" for URLLoader, as well as fileReference.

 var myXMLLoader:URLLoader = new URLLoader(); var urlStr:String = "http://www.yourdomain.com/php/twitter.php"; var myVariables:URLVariables = new URLVariables(); myVariables.twitterID = "yourtwitterID"; var myURLRequest:URLRequest = new URLRequest(urlStr) myURLRequest.data = myVariables; setTimeout(function():void { myXMLLoader.load( myURLRequest ); }, 1); myXMLLoader.addEventListener(Event.COMPLETE, onXMLLoadHandler); 
+1
source

In response to headwinds:


In AS3 you need to import flash.utils.setTimeout. The syntax for setTimeout is: setTimeout(A, B, ...rest);

Where B is the function to be called later, A is the delay in ms (for example, 1000 per second) and C is any number of parameters that you need to provide for the function, separated by a comma.

eg.

 import flash.utils.setTimeout; // package, etc //main function setTimeout(respond, 500, true, false); private function respond(A : Boolean, B : Boolean) : void { var result : Boolean = A == B; trace(result); } 
+1
source

You need to handle the error:

 loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPError); protected function onHTTPError(e:HTTPStatusEvent):void{ trace("HTTPError"+e.status); } 

This way it will handle the error and work fine.

+1
source

Source: https://habr.com/ru/post/1444268/


All Articles