title: LoaderContext and ApplicationDomain changes with Adobe AIR?
body: <p>I'm currently experimenting with loading external SWF files from both an standard AS3 application, and an AIR application. It seems that the AIR application doesn't act the same way a standard SWF run by the Flash Player does.</p>
  
  <p>According to the <a href="http://livedocs.adobe.com/flash/9.0_fr/ActionScriptLangRefV3/flash/system/LoaderContext.html#applicationDomain" rel="noreferrer">documentation</a>, the <code>applicationDomain</code> property of <code>LoaderContext</code> is usable in an AIR application too, but it just seems to be not working.</p>
  
  <p>I have the following code :</p>
  
  <pre><code>package {
      import flash.display.Loader;
      import flash.display.LoaderInfo;
      import flash.display.Sprite;
      import flash.events.Event;
      import flash.net.URLRequest;
      import flash.system.ApplicationDomain;
      import flash.system.LoaderContext;
  
      public class Invoker extends Sprite
      {
          private var _ldr : Loader;
  
          public function Invoker()
          {
              _ldr = new Loader();
              _ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onChildOneComplete);
  
              var ldrC : LoaderContext = new LoaderContext(false,
                  new ApplicationDomain(ApplicationDomain.currentDomain)
              );
  
              _ldr.load(new URLRequest("otherSwf.swf"), ldrC);
          }
  
          private function onChildOneComplete(e : Event) : void
          {
              var c1ad : ApplicationDomain = (e.target as LoaderInfo).applicationDomain;
              var inad : ApplicationDomain = ApplicationDomain.currentDomain;
  
              trace("Child One parentDomain : " + c1ad.parentDomain);
              trace("Invoker parentDomain   : " + inad.parentDomain);
  
              trace("Child One has Invoker  : " + c1ad.hasDefinition("Invoker"));
              trace("Invoker has Invoker    : " + inad.hasDefinition("Invoker"));
          }
      }
  }
  </code></pre>
  
  <p>Compiling this code as an SWF file and launching it with the Flash Player does this output, which seems right :</p>
  
  <pre><code>Child One parentDomain : [object ApplicationDomain]
  Invoker parentDomain   : null
  Child One has Invoker  : true
  Invoker has Invoker    : true
  </code></pre>
  
  <p>But the same code as an AIR application does a different output :</p>
  
  <pre><code>Child One parentDomain : null
  Invoker parentDomain   : null
  Child One has Invoker  : false
  Invoker has Invoker    : true
  </code></pre>
  
  <p>According to the documentation, the first output (using a SWF with Flash Player, and not an AIR application) is the right one. Also, playing around with this snippet and changing the application domain to others possible configurations (like <code>new ApplicationDomain(null)</code>, or <code>ApplicationDomain.currentDomain</code>) does exaclty what the documentation says with the SWF, but does not change the output of the AIR application.</p>
  
  <p>Any clue why AIR is simply ignoring the application domain passed to the loader context ? Any documentation about this particular issue ?</p>
  
  <p>Thank you very much.</p>