AIR, Flex, LocalConnection and the mystery StatusEvent

July 21st, 2007

I have had some code working for a while that stopped working with the latest build of Flex Builder 3 I installed. The code was an AIR application that received messages from arbitrary Flex applications using LocalConnection. The problem with LocalConnection and AIR is the inherent security issues that arise. AIR is on the desktop with no domain sandbox and the Flex apps usually are coming from application with domains. So typically I set the allowDomain() method on the LocalConnection instance, and then it works.

I didn’t change any of my code and I was getting a mystery “Error #2044: Unhandled statusEvent:. level=error, code=”. After digging around for a while I noticed the Security class in the AIR framework and that it also had an allowDomain method. I added Security.allowDomain(”*”); to my code and it started working again.

LocalConnection with AIR and Flex on the Mac OS X seems to be a bit weird at times. So I am not sure it was a Mac, AIR, or Flex thing. But if you come across some strange #2044 with no explanation make sure your Flash Player/AIR security sandboxes are correct by setting allowDomain where ever needed (Security, LocalConnection instance, etc…).

Entry Filed under: AIR (formerly Apollo), Adobe Flex, Rich Internet Applications

5 Comments Add your own

  • 1. Lanny  |  2008-04-08 at 2.56 pm

    I am having a similar problem, however the Security.allowDomain(”*”) throws a SecurityError of its own:

    SecurityError: Error #3207: Application-sandbox content cannot access this feature.
    at flash.system::Security$/allowDomain()

    Any thoughts?

  • 2. Renaun Erickson  |  2008-04-08 at 2.59 pm

    I have since dropped the Security.allowDomain(”*”), and it does give you that error.

    This is what i have now:

    connection = new LocalConnection();
    connection.allowDomain(”*”);
    connection.client = this;
    connection.connect(”_myconnect”);

    It works fine, try with out the Security.allowDomain() if that doesn’t work share an example NetConnection code you are trying.

  • 3. Timo Stamm  |  2008-08-23 at 5.44 pm

    I just ran into this problem too, but I don’t see any connection to the security settings. The problem is not consistent. It only showed in release builds for me.

    Got rid of the problem by reordering the code a little bit and doing a rebuild. It’s not the first time this has worked. The compiler has some issues it seems.

  • 4. Mauricio Reyno  |  2008-08-27 at 2.34 pm

    My problem is a little different, but maybe anyone can help me.
    I have an swf1 who loads another swf2 into (both flex made).
    When I send something to the class .as of swf2 seems to dont have connection with none of both swf´s. It seems to be on another level but dont see a solution for it. Seems the .as class dont have connection with the localconnection or any other component on swf2.

    Any ideas?

    tnx

  • 5. Shanimal  |  2008-08-28 at 2.40 pm

    Seeing in AS3 app for FB, having crossdomain issue onfbjs-bridge. Note that this works in FireFox (FAIL only in IE)

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Disclaimer: I work as a Flash/Flex Developer for Adobe Systems Incorporated. The opinions expressed here represent my own and not those of my employer.

My Amazon.com Wish List

Calendar

July 2007
S M T W T F S
« Jun   Aug »
1234567
891011121314
15161718192021
22232425262728
293031  

Most Recent Posts


Flex.org - The Directory for Flex