Dynamic "gotoAndPlay" Problem


I did try searching, but it was a bit difficult cos anything I did search is just a generic term, so it comes up with loads of results :slight_smile:


I’ve been learnin how to develop games (cheers joMan :)), but when I was working on joMan’s tutorial, I realised that when playing animations he has used “nextFrame()”, which is all good…

But, in mine, I have created a MC, with 4 different animations, and I want a different one to play according to input (DOWN, UP, LEFT, RIGHT). I created the animation, and labelled the right frames…But when I get to controlling the mc from the stage, it just doesn’t animate, and I can’t figure out why :confused:

Here’s the code:

moveWabbit = function () {
	with (Wabbit) {
		if (Key.isDown(Key.UP)) {
			_y -= 3;
		} else if (Key.isDown(Key.DOWN)) {
			_y += 3;
		} else if (Key.isDown(Key.RIGHT)) {
			_x += 3;
		} else if (Key.isDown(Key.LEFT)) {
			_x -= 3;
		} else {
_root.onEnterFrame = moveWabbit;

When I run the file, the mc moves around, but the animations don’t play. I’m sure it’s something simple but it’s really annoying. Can anyone help explain why gotoAndPlay doesn’t work? (I think it might have something to do with the fact it’s “onEnterFrame”, but I still need a solution) :slight_smile:

Cheers :slight_smile: