PDA

View Full Version : If movieclip is at a certain frame then...


alexdarkred
12-10-2011, 01:05 PM
Okay, I have a movieclip. Within the movieclip is a character, at frame 1 it is still, frame 2(labelled 'walk') to 25 is a walkcycle to stop at point 2(labelled 'still2') . then this is repeated to extend the walk cycle.
I have script to make my character go from 'still' to 'walk' and then stop at 'still2' on a right key press.
What I want to know is how to test if movieclip is at 'still2' then gotoAndPlay 'walk2' on right key press.
Here is my current script.. on frame 1 of scene.

stop();
stage.focus = stage;
//keyboard control over sherlock to control direction
stage.addEventListener (KeyboardEvent.KEY_DOWN, sherlockController);
function sherlockController (e:KeyboardEvent) {
switch (e.keyCode) {
case Keyboard.LEFT:
sherlock_mc.x-=0;
break;
case Keyboard.RIGHT:
sherlock_mc.gotoAndPlay("walk");
if (sherlock_mc.frame == 'still2')
sherlock_mc.gotoAndPlay('walk2');
break;
}
}

If anyone could help as simply as possible, I am quite new, it would be great.
Thanks!

LOLFlash
12-11-2011, 12:30 AM
I think use currentFrame properties