Home > Uncategorized > SecurityError: Error #2000: No active security context.

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");

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);

Categories: Uncategorized Tags: ,
  1. pallzoltan
    November 18th, 2008 at 08:03 | #1

    well, i get this error when trying to access the data property of a filereference… :) weird stuff

  2. Andy
    January 2nd, 2009 at 23:47 | #2

    I just joined this tragic club… What the hell is this error about? I get it when using LocalConnection within FlexBuilder 3 (in Eclipse).

  3. Lisa
    February 11th, 2009 at 11:32 | #3

    I’m with you pallzoltan. When trying to access the data property of a filereference.

  4. Ivan
    April 15th, 2009 at 10:21 | #4

    @pallzoltan

    The filereference.data error can also be fixed with the setTimeout or timer function.

  5. Ingo
    May 20th, 2009 at 01:51 | #5

    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.

  6. June 17th, 2009 at 10:30 | #6

    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.

  7. February 22nd, 2010 at 00:03 | #7

    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)

  1. June 13th, 2009 at 09:28 | #1