Copy link to clipboard
Copied
let's say from frame one I want to go to frame two. But instead of clicking on a button with a mouse, I use the key binds instead. Problem is when I press on the keys, it doesn't work.
Heres the code I tried to reenact.
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
function keyDownHandler(e:KeyboardEvent):void
{
if (currentScene.name == "Frame 1")
{
if (e.keyCode == Keyboard.E)
gotoAndStop(2);
}
else if (currentScene.name == "Frame 2")
{
if (e.keyCode == Keyboard.F)
gotoAndStop(3);
}
else if (currentScene.name == "Frame 3")
{
if (e.keyCode == Keyboard.G)
gotoAndStop(4);
}
}
stop();
if (!stage.hasEventListener(KeyboardEvent.KEY_DOWN))
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
Thanks
Hi.
You want to move from frame to frame, but you're checking for scenes names:
if (currentScene.name == "Frame 2")
Shouldn't it be something like:
if (currentLabel == "home")
or
if (currentFrame == 1)
?
Please let us know.
Regards,
JC
Copy link to clipboard
Copied
Hi.
You want to move from frame to frame, but you're checking for scenes names:
if (currentScene.name == "Frame 2")
Shouldn't it be something like:
if (currentLabel == "home")
or
if (currentFrame == 1)
?
Please let us know.
Regards,
JC
Copy link to clipboard
Copied
Wow, what a quick reply. I was still editing my post. :0
Thanks
Copy link to clipboard
Copied
Haha!
Excellent!
You're welcome!