SecurityError: Error #2000: No active security context.
Always interesting to throw an error that has only 4 obscure results in google.
Using setTimeout with navigateToURL:
var urlRequest:URLRequest = new URLRequest("http://google.com");
setTimeout(navigateToURL, 1000, urlRequest, "_blank");
setTimeout(navigateToURL, 1000, urlRequest, "_blank");
Generates:
SecurityError: Error #2000: No active security context.
at global/flash.net::navigateToURL()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at <anonymous>()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
A work around is to wrap the call in an anonymous function:
setTimeout(function():void { navigateToURL(urlRequest, “_blank”); }, 1000);
well, i get this error when trying to access the data property of a filereference… :) weird stuff
I just joined this tragic club… What the hell is this error about? I get it when using LocalConnection within FlexBuilder 3 (in Eclipse).
I’m with you pallzoltan. When trying to access the data property of a filereference.
@pallzoltan
The filereference.data error can also be fixed with the setTimeout or timer function.
For filereference.data to work as expected, the load() function has to be wrapped:
setTimeout( function():void{fileReference.load();}, 1);
Maybe there are some more elegant ways to achieve this, however it works for me.
FYI, I just wasted a few hours because the FlexBuilder debugger displays this message until the getter is actually accessed in the code. Apparently, the debugger runs in a separate security context. As it turns out, this “error” wasn’t even a problem. So for a bit of advice, try doing a trace(“” + loader.content) before you jump to conclusions.
Can anyone explain what this error even means? I’m getting it trying to use setTiemout to delay the intitial start a Timer:
setTimeout(myTimer.start, 1000)
I’ve wrapped filereference.load to setTimeout as Ingo suggested but filereference.data still throws the same error. I cannot find any other solution. I am not sure why I am getting this error when I am trying to upload image file and how I can resolve. Any one… Please help…
It appears that this error can appear if a function call triggered by LocalConnection throws an error. Unintuitive case, for sure. Thankfully, it became obvious when I ran the debugger.
i get this when tring to acess games on facebook
Had this problem when rendering HTML in a Flex component that was using the tag
^^^ .. that was using the “img” tag
i had this error when loading in a xml file…so weird, never happened before today.
ok, just solved the problem,
my code before was
var xmURL:URLRequest=new URLRequest(“C:/Users/frankshan/Downloads”);
it’s suppose to be
var xmURL:URLRequest=new URLRequest(“C:/Users/frankshan/Downloads/timeline.xml”);
so stupid…. :(
The same issue happened to me when i was trying to call the save() method of the FileReference class. The workaround that I found to solve this issue is add a listener for the IOErrorEvent and just catch the exception that is trown:
Here my code snipped:
var byteArray:ByteArray = myPDF.save(Method.LOCAL);
var fileRef:FileReference = new FileReference();
fileRef.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
fileRef.save(byteArray, “MyReport.pdf”);
private function onIOError(event:Event):void {
//do nothing here
}
Hope this helps somebody else.
Just wanted to add my experience here, I was looping through a bunch of URLs and downloading images from the urls with a Loader, I was getting this error and it turned out some of the URLs had changed and no longer contained the data I was trying to download.
Simple tip, as juanargento says, catch the IOErrorEvent and add a breakpoint on it – when you hit it, look through the data to see if you’re trying to download a null value!
I’m getting the same error message when playing all pogo games. HELP
I am simply trying to load a local jpg and I get this error!
yeah, when there’s a problem in the URL, you get this error. trace out the url, make sure your assets are in the right place.
Hey Frank,
you must be the brain here..
if you receive this error when trying to establish a local connection, don’t forget to add this to your code :
localconnectioninstance.client=this;
this is for redirecting requests to a different object other than the receiving local connection instance