i am trying to make a simple flash game.
And I've been searching about this problem but I can't found any questions/answers that helped me, so here it is:
I am trying to use addChild()
to generate the pokemon Movieclips
var comPkm:MovieClip = new bulbasaur;
comPkm.x = 620;
comPkm.y = 270;
comPkm.height = 80;
comPkm.width = 77;
addChild(comPkm);
comPkm.gotoAndPlay("idle");
the problem is: The "idle" stance for the pokemon does not play at all.
But, if I put the pokemon directly to the timeline it would work.
Any idea what's wrong and what's the solution? Thanks :)
Unfortunately, setting some properties of a MovieClip causes the clip to not play an animation. Setting x, y, height, or width break a timeline animation. The silent failure without so much as a trace message confounded me several times. A workaround is create a parent placeholder and have the ActionScript modify parent or child. Example:
comPkm.parent.x = 620;
comPkm.parent.y = 270;
comPkm.parent.height = 80;
comPkm.parent.width = 77;
Related: Scaling onstage MovieClip w/ "scaleX" breaks timeline animation ...really?
If you modify any of the following properties of a MovieClip object that contains a motion tween, the playhead is stopped in that MovieClip object: alpha, blendMode, filters, height, opaqueBackground, rotation, scaleX, scaleY, scale9Grid, scrollRect, transform, visible, width, x, or y. However, it does not stop the playhead in any child MovieClip objects of that MovieClip object.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/MovieClip.html
In my experience, the playhead is permanently broken, ignoring future calls to gotoAndPlay.