Gah, another problem making me go
. If there is a flash master reading this I would be very appreciative of any hints.
I load the swf anim by embedding it as:
[Embed(source = "../graphics/explosion1.swf")] public static var ExplosionSwf:Class;
Then I create a MovieClip object and init:
expl = new Assets.ExplosionSwf;
And the animation works wonderfully except for the part where the expl.stop() function doesn't work and the animation just keeps looping...
Any suggestions
The [Embed] tag strips code from swfs.
Two solutions: 1. Use a swc instead, and add it to the compiler libraries.
2. Use addFrameScript to put the stop() in:
{
expl = new Assets.ExplosionSwf;
expl.addFrameScript(expl.totalFrames, stopExpl);
}
function stopExpl():void {
expl.stop();
}
You may be able to get away with anonymous functions, except they are ugly and are likely to stop the MovieClip from being garbage collected:
expl.addFrameScript(expl.totalFrames,
function():void {
expl.stop();
expl.addFrameScript(expl.totalFrames, null }
);