-
I'd like to change my code from using the left key=previous frame/ right key= next fr
I'D LIKE TO CHANGE MY CODE FROM USING THE LEFT KEY=PREVIOUS FRAME/ RIGHT KEY= NEXT FRAME TO
ANY KEY=NEXT FRAME. HERE IS MY CODE. PLEASE HELP ME OBI WAN KENOBI, YOU'RE MY ONLY HOPE:
stop(); stage.addEventListener(KeyboardEvent.KEY_DOWN, changeSection); function changeSection(event:KeyboardEvent):void { switch (event.keyCode) { case Keyboard.RIGHT : nextFrame(); break; case Keyboard.LEFT : prevFrame(); } }
-
.
Hi,
Perhaps not the best way, but all I can think of right now
PHP Code:
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, pressAnyKey);
function pressAnyKey(e:KeyboardEvent)
{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, pressAnyKey);
stage.addEventListener(KeyboardEvent.KEY_DOWN, pressSingleKey);
nextFrame();
}
function pressSingleKey(event:KeyboardEvent):void
{
switch (event.keyCode)
{
case Keyboard.LEFT :
stage.removeEventListener(KeyboardEvent.KEY_DOWN, pressSingleKey);
prevFrame();
break;
}
}
-
.
Hi,
The last post only works with two frames, I suspect you have more so try
PHP Code:
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, pressAnyKey);
function pressAnyKey(event:KeyboardEvent)
{
switch (event.keyCode)
{
case Keyboard.LEFT :
prevFrame();
break;
default :
nextFrame();
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|