Hi all,
I am facing a problem where I have a listener listening to Event.ENTER_FRAME:
public function showAnimation():void {
var character:MovieClip = new Character();
character.setAnimation("jump");
character.addEventListener(Event.ENTER_FRAME, onJump);
}
public function onJump(e:Event):void {
var character:MovieClip = e.currentTarget as MovieClip;
var currentFrame:uint = character.currentFrame;
var totalFrames:uint = character.totalFrames; // total is 10
trace("currentFrame: " + currentFrame);
if (currentFrame >= totalFrames) {
character.stop();
character.removeEventListener(Event.ENTER_FRAME, onJump);
character.stand();
}
}
Usually, the normal tracing for currentFrame should be “1, 2, 3, 4…10” but for my case, I get it as “1, 10”. It skips the rest of the frames. Anyone experienced this before?
Is there a better way to check if a movie clip reached its last frame other than checking its currentFrame or currentLabel (putting a label “end” to check for)?