Monday, February 4, 2008

Communicating between AIR (swf) windows

I wanted to make a quick note on something I came across yesterday as I was working on my AIR app that uses separate NativeWindows.
Essentially what I wanted to do was call a method in another swf and pass it an argument.. a path to a song in the local file system. The way I approached this was with LocalConnection. (If there is another way to communicate between NativeWindows please let me know!) I had set up listeners in the swf for a status.level of either 'status' or 'error' so I could make sure I was actually communicating. Every time I tried to communicate between the two swf's I would get an 'error' condition. What was the problem? It seems that in AIR you must allow the local domain. As soon as I added:

_conn.allowDomain('*');
Everything worked fine.

Hopefully this will help someone searching for some answers on communicating between windows.

0 comments: