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?