How can I get a movie clip to play when pressing the right arrow key? The movie clip is called helicopter and it has stop(); on its first frame (with an animation following).
Here is the loop that tells the arrow keys what to do when pressed:
public function loop(e:Event) : void
{
vy += gravity;
y += vy;
x += vx;
if (vy > maxspeedG)
vy = maxspeedG;
else if (vy < -maxspeed)
vy = -maxspeed;
if (vx > maxspeed)
vx = maxspeed;
else if (vx < -maxspeed)
vx = -maxspeed;
if (vx > 0)
scaleX = 1;
else if (vx < 0)
scaleX = -1;
if (y > stageRef.stageHeight) {
y = stageRef.stageHeight;
vy = -2;
}
rotation = vx*2;
if (key.isDown(Keyboard.RIGHT))
vx += .5;
[SIZE=3]**this.gotoAndPlay(helicopter.mc);**[/SIZE]
else if (key.isDown(Keyboard.LEFT))
vx -= .5;
else
vx *= friction;
if (key.isDown(Keyboard.UP))
vy -= 1;
else if (key.isDown(Keyboard.DOWN))
vy += .5;
}
}
The bold/enlarged area is what is not working… am I doing something completely wrong? Thank you for any help.
-frostBite