I have a .swf animation that I created in Flash Professional. To use it in my actionscript project, I embed it as follows:
[Embed(source="../lib/fetching.swf")]
public var Fetching:Class;
I then create an instance and add it to the stage as follows:
//class variable
var mc:MovieClip;
mc = new Fetching();
this.addChild(mc);
This causes my animation to appear on the screen and loop indefinitely. However, when calling mc.stop(), the animation does not stop. I’ve tried removing the movieclip from the stage by calling removeChild(mc) but adding a listener on the ENTER_FRAME event told me the movieclip is still playing over and over.
you should set a Embed source mimeType, and you convert to ByteArray. and loaded. because you can’t Direct Type Casting Fetching Class to MovieClip. If you define explicitly mimeType and convert by force, you’ll get about
TypeError #1034: Type Coercion failed: cannot convert YourProject_Fetching@108b780d1 to flash.display.MovieCliprefer a following code.