Ok, not getting it, what small/stupid/simple concept am I missing?

I want to load a Flash 9 SWF into Flex and then call a function within
the SWF once loaded.  I can do it with a SWFLoader but I would like to
use loadBytes.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="initApp();">

<mx:Script>
<![CDATA[

import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.utils.ByteArray;

private function initApp():void
{
     var swfLoader:URLLoader = new URLLoader();
     swfLoader.dataFormat = URLLoaderDataFormat.BINARY;
     swfLoader.addEventListener( Event.COMPLETE, getSWFBytes );
     swfLoader.load( new URLRequest("Flash9File.swf") );
}

private function getSWFBytes( event:Event ):void
{
     var urlLoader:URLLoader = event.currentTarget as URLLoader;
     var swfBytes:ByteArray = urlLoader.data;
     // Now what?
     // Do I create a new class and associate it with the bytes
     // and then add it as a child to my container?
     // SWFHolder.addChild( ? );
}

]]>
</mx:Script>

<mx:Canvas id="SWFHolder" x="10" y="10" width="428" height="346"
backgroundColor="0xEDEDED" borderColor="0x666666" />

</mx:Application>

Reply via email to