title: Loading Swf with bytearray in AIR
body: <p>We have requirement with the AIR application which loads the flex generated swf which inturn loads the flash generated swf using SWFLoader. This is not working as desired. This gives the following error:
  SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.</p>
  
  <p>This is our AIR application.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()"&gt;
  &lt;mx:Script&gt;
  &lt;![CDATA[
  
  import mx.controls.SWFLoader;
  
  [Embed(source="FlexLoadingFlash.swf")]
  public var flexMovie:Class;
  
  private function initApp():void {
      // First convert the Swf into MovieClip
      var movieclip:MovieClip = new flexMovie();
  
      // get the byteArray from movieClip
      var byteArray:ByteArray = movieclip.movieClipData; 
  
      var swfLoader:SWFLoader = new SWFLoader();
  
      // load bytearray into swfLoader
      swfLoader.source = byteArray;
  
      swfLoader.maintainAspectRatio = false; 
      swfLoader.percentHeight = vbox.height;
      swfLoader.percentWidth = vbox.width;
      swfLoader.invalidateDisplayList();
      swfLoader.invalidateSize();
  
      // now add the swfloader into container
      vbox.addChild(swfLoader); 
  } 
  
  ]]&gt;
  
  &lt;/mx:Script&gt;
  
  &lt;mx:VBox id="vbox" width="100%" height="100%" verticalCenter="0" horizontalCenter="0" cacheAsBitmap="true" &gt;
  
  &lt;/mx:VBox&gt;
  
  &lt;/mx:WindowedApplication&gt;
  </code></pre>
  
  <p>Please let me know how can we fix this issue.</p>