AIR, Flex, LocalConnection and the mystery StatusEvent
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…).
Pingback: Paul Gregoire’s Blog » Blog Archive » The dreaded 2044 error