Hi Everyone,

I'm trying to use a Movie Clip that I created in Flash CS4 in Flex. I
am using Flex builder 3 as my IDE.

I have read the following blog:

http://www.gskinner.com/blog/archives/2007/03/using_flash_sym.html

I can get the first frame of the Movie Clip to display in the Flex
test application but there is no animation. From what I've read on
other sites it seems that Flex strips out the time line (correct me if
i'm wrong).

My test project is as follows.

(1) A mxml application to display the play and stop buttons of the
movie clip player and a mx.containers.Canvas to display the animation.
(2) ActionScript class which acts as a player for the Movie Clip.
(3) ActionScript factory which generates SWF's into MovieClips.
(3) ActionScript class taken from
http://www.transmote.com/share/code/EmbeddedLibrary.as This is
referenced from the above blog.

I have two methods so far in the Factory.

public static function loadFromPath(callBack:Function, swf:String):void
{
    var loader:SWFLoader = new SWFLoader();
    loader.addEventListener(Event.COMPLETE, callBack);
    loader.load(swf);
}

public static function loadFromBytes(callBack:Function,
swfBytes:Class):void
{
    var embLib:EmbeddedLibrary = new EmbeddedLibrary(swfBytes);
    embLib.addEventListener(Event.INIT, callBack);
}

>From the player I can call either of these methods and get the same
result, which is the first frame is shown but no animation.

For example, if I call the second static method:

[Embed(source="assets/BlueCircles.swf",
mimeType="application/octet-stream")]
private static var SWFBytes:Class;

...

SWFLoaderFactory.loadFromBytes(onBytesLoaded, SWFBytes);

...

private function onBytesLoaded(evt:Event):void
{
    var embLib:EmbeddedLibrary = (evt.target as EmbeddedLibrary);
    embLib.removeEventListener(Event.INIT, onBytesLoaded);
    var dispObj:DisplayObject =
embLib.getSymbolInstance(MOVIE_CLIP_CLASS_NAME);                        
    mc = (dispObj as MovieClip);
    addMovieClip();
}

private function addMovieClip():void
{
    container.addChild(mc);
    addChild(container);                        
}

Ideally I would like to upload my project files for clarity but there
is no attachment button on this page where i'm writing.

Any help in trying to run my movie clip would be appreciated.

Regards

Paul

Reply via email to