Search code examples
haxecreatejs

Why MovieClip is not visible?


I tried to use createjs to create a movieClip and add an image inside it like this:

rect2 = new Bitmap(_preloader.getResult("rect").result);
mv = new MovieClip("single", 0, false, []);
mv.addChild(rect2);
_stage.addChild(mv);

I expect to see rect2 on stage, but it dose not show up, if I added rect2 to stage it will show up, so what's I am missing here?


Solution

  • Is there any reason you are using MovieClip? It is mainly used to handle export from Flash Pro using Toolkit for CreateJS.

    Instead, you might try using a Bitmap instance, which wraps an image, canvas, or video element.

    One note for MovieClips is that you need to gotoAndStop/gotoAndPlay in order to set the initial state, it does not "default" to the first frame like Flash.