views:

201

answers:

0

Hi, my client want to have all resources embedded into the Main SWF which i create with Flex. The UI itself origins form a .FLA that must have timeline actionscript (AS3). After I embed the SWF there seems to be NO timeline AS in the embedded SWF. Is this possible to solve?

I Embed like this:

public var templ: TemplateBase;


[Embed(source="images/template_banner.swf", mimeType="application/octet-stream")]
public var TemplateSWF:Class; 

...

var ba : ByteArray = new TemplateSWF() as ByteArray;
var l : Loader = new Loader();
l.loadBytes(ba); 
l.addEventListener(Event.ADDED_TO_STAGE, onTemplateAdd);
addChild(l);

private function onTemplateAdd(evt:Event):void{
  templ  = evt.target.contentLoaderInfo.content;
}

In template_banner.swf there is a stop(); in frame 1, and some code in frame 2. I trace in both frames but nothing is showing in the Flex (4) debugger. After the swf is added to stage I do play() in the TemplateBase class.

The thing is that play and all the AS code in the loaded SWF is totally dead.

My question is: Is there a way to keep the timeline AS code in the embedde SWF? And yes I need to embed the SWF into the Flex main file :/

Thanks, Rob