Hai there.
So I have bunch of animations on the main timeline, for example one of them starts at frame 51 and ends at 100, another one starts at 101 and ends at 150, and another one starts at 151 and ends at 200. I gave layertags to them such as “HeavyMG” at frame 51, “ShockRifle” at frame 101 and “Flamethrower” at frame 151.
When I press the right arrow key, it jumps to the desired frames, like it will jump to “HeavyMG” from “ShockRifle” and when pressed again to “Flamethrower”. The problem is, when I press the left arrow, it can jump from “Flamethrower” to “ShockRifle”, but it won’t jump back to “HeavyMG” from “ShockRifle”. It keeps playing “ShockRifle” even though the code tells it to go to the spesific layertag.
Here’s the code I used :
stage.addEventListener(KeyboardEvent.KEY_DOWN, Grunt04);
function Grunt04(event:KeyboardEvent):void
{
if (event.keyCode == 39)
{
gotoAndPlay(“Flamethrower”);
}
if (event.keyCode == 37)
{
gotoAndPlay("HeavyMG");
}
}
In this case, we are at the layer “ShockRifle” which is frame 101, and it should jump back to the layer “HeavyMG” which is layer 51, but it goes back to “ShockRifle” again.
Thanks for any help.