Controlling a movie clip (playing forward & backward) with multiple buttons

Hey guys, i started tinkering around with actionscript a few weeks back. Hence, i don’t really know the more complicated syntax. However, since i was learning programming (C, VB etc) a looong time back, i figured i’d be able to work out the underlying logic.

Problem: I can get a movie clip to play forward and backwards with two buttons. However, when i’m adding more buttons, which are supposed to get the movie clip to start playing from wherever it is, and to come and stop at x frame, i’m hitting a roadblock.

My stage currently has 3 buttons, with the following code:

BUTTON 1

on (release) {
	_global.newLink = 1;
	_global.buttonValue = "one";
}

BUTTON 2

on (release) {
	_global.newLink = 2;
	_global.buttonValue = "two";
}

BUTTON 3

on (release) {
	_global.newLink = 3;
	_global.buttonValue = "three";
}

My movie clip has the following script on it:

onClipEvent (load)
	{
	stop();
	_global.currentLink == 1;
	_global.newLink == 1;
	_global.buttonValue == "none";
	}

onClipEvent (enterFrame)
	{
	stop();
	
	if (_global.currentLink - _global.newLink < 0)
		{
		_global.dir = "fwd";
		}
	else if (_global.currentLink - _global.newLink > 0)
		{
		_global.dir = "bkw";
		}
	else
		{
		_global.dir = "stay";
		}
		
// FOR FORWARD MOTION
	if (_global.dir == "fwd")
		{
		if (_global.buttonValue == "two")
			{
			if (this._currentframe == 15)
				{
				stop();
				}
			else
				{
					this.nextFrame();
				}
			}
		else if (_global.buttonValue == "three")
			{
			if (this._currentframe == 24)
				{
				stop();
				}
			else
				{
					this.nextFrame();
				}
			}
		}

// FOR BACKWARD MOTION
	else if (_global.dir == "bkw")
		{
		if (_global.buttonValue == "two")
			{
			if (this._currentframe == 15)
				{
				stop();
				}
			else
				{
					this.prevFrame();
				}
			}
		else if (_global.buttonValue == "one")
			{
			if (this._currentframe == 1)
				{
				stop();
				}
			else
				{
					this.prevFrame();
				}
			}
		}
	else if (_global.dir == "stay")
		{
		stop();
		}
	}

Where am i screwing up?

Sorry, forgot to attach the file, if anyone needed it.

Hey, i fixed part of the mistake.

Changed this code:

onClipEvent (load)
	{
	stop();
	_global.currentLink == 1;
	_global.newLink == 1;
	_global.buttonValue == "none";
	}

to this:

onClipEvent (load)
	{
	stop();
	_global.currentLink = 1;
	_global.newLink = 1;
	_global.buttonValue = "none";
	}

Now the movie clip plays in one direction, atleast…

It’s done!

I just had to add the following code inside the movie clip, on it’s timeline:

FRAME1

_global.currentLink = 1;

FRAME15

_global.currentLink = 2;

FRAME24

_global.currentLink = 3;

I’m attaching the file, if you guys wanna go through it and reuse the code…

Here’s the swf for a quick view:

http://img515.imageshack.us/my.php?image=reversemoviescriptiy8.swf