title: Flex mx:SWFLoader Loads Incorrect SWF File
body: <p>I'm fairly new to Flex and am having an issue where I have a main Flex program (let's called it "Parent.swf") attempting to load another Flex application (Child.swf) via the SWFLoader class/component.
  Environment is Flex 4.6 on FlashDevelop.</p>
  
  <p>The call appears to work correctly (i.e. no IO or sandbox errors are returned), only that it seems to reload the "Parent.swf" into the SWFLoader instead of the "Child.swf".</p>
  
  <p>For example, I have the Parent.swf containing:</p>
  
  <pre><code>&lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/mx"
             initialize="doStartup()" 
             width="1024" height="768"&gt;
  
  ...
  
  &lt;fx:Script&gt;
  
      &lt;![CDATA[
  
          private function doStartup():void
          {
              trace("STARTING UP!");
          }
  
          ....
  
      ]]&gt;
  
  &lt;/fx:Script&gt;
  
  &lt;mx:VBox top="10" left="10" width="100%" horizontalAlign="center"&gt;
      &lt;mx:Label text="I'M A LOADER!" /&gt;
  &lt;/mx:VBox&gt;
  &lt;mx:VBox top="10" left="10" width="100%" horizontalAlign="center"&gt;
      &lt;mx:SWFLoader 
                      id="pluginLoader"
                      source="plugins/Child.swf" 
  
                      autoLoad="true" 
                      height="400" width="400" 
                      complete="onPluginLoaded(event);" 
                      ioError="onPluginLoadError(event);" 
                      securityError="onPluginSecurityError(event);" 
  
                      httpStatus="onHttpStatus(event);"
                      init="onInit(event);"
                      open="onOpen(event);"
                      progress="onProgress(event);"
                      unload="onUnload(event);"
                      /&gt;
  &lt;/mx:VBox&gt;
  
  ....
  </code></pre>
  
  <p>The child swf contains:</p>
  
  <pre><code>....
  &lt;mx:Label text="I'M A PLUGIN!" /&gt;
  ....
  </code></pre>
  
  <p>The trace above (i.e. "STARTING UP!") is repeated on the load of Child.swf, followed by another attempt to load Child.swf which fails because the working directory for the call is now in the "plugins" directory.
  So it seems to know the file exists and load it, but somehow swaps in Parent.swf over the top of it.
  Note that if I execute Child.swf directly, I'm able to verify that it is what I expect it to be (i.e. a flex app with a single label saying "I'M A PLUGIN!").</p>
  
  <p>I've also tried various other approaches such as instantiating a SWFLoader via code but the same issue occurs. I even tried to switch to Modules but had the same behaviour there too.
  It fails whether run locally or run via a web server.</p>
  
  <p>Does anyone have any idea how this could occur? Is there some way that the main.mxml of Parent.swf is overriding Child.swf?
  (Sorry for the essay)</p>