Search code examples
actionscript-3flash-cs5

How do I use AS3 to embed an SWF file and control is using .play()?


I have a folder "/assets/animations" filled with .swf files. I would like my AS3 script to embed all these assets so they can be later called to play or stop.

I hear a lot about the Loader class but it looks like it doesn't embed all the files at compile time but rather grab them from a url when needed.

Basically these assets are cut scenes for a flash game. I would like all of them to be present in one final .swf so its easy to play on any machine without an internet connection.


Solution

  • [Embed(source="scene1.swf", symbol="scene1ID")]
    public var Scene1:Class;
    
    private var scene1:MovieClip = new Scene1();
    scene1.play(); 
    

    This should help you... http://www.bit-101.com/blog/?p=853