Be a Supporter!

Disablingkeys and other help needed

  • 232 Views
  • 0 Replies
New Topic Respond to this Topic
CoolDrMoney
CoolDrMoney
  • Member since: Jan. 14, 2005
  • Offline.
Forum Stats
Member
Level 18
Animator
Disablingkeys and other help needed 2010-05-10 17:21:32 Reply

I've started creating a game for my interactive class and I need to know how to disable keys on the keyboard in flash.

Another problem in my game is that at one point I tell the user to push the up key. The user pushes the up key at the appropriate time and it gotoAndPlays the appropriate scene perfectly. Then when the next instance occurs, the user is told to push the down key. Once the down key is pressed, it plays the appropriate frame but the user can continue pressing the downkey and it will go back to the frame where I originally told the movie to play when the down key was pressed. The other strange part is that at the same time the down key can be pressed, the up key can also be pressed and will carry out its function of going back to the place in the timeline that it played when the user first pressed up. it's only at this area in the movie that there is this problem.

Please help me! Heres my code for both the up button area and the down button area.

Up button:

stage.addEventListener(KeyboardEvent.KEY _DOWN, upkeyhandler1);

stage.focus = buttonpushup;

function upkeyhandler1(event:KeyboardEvent): void{
if(event.keyCode == Keyboard.UP)
{gotoAndPlay(717)}
}

down button:

stage.addEventListener(KeyboardEvent.KEY _DOWN, downkeyhandler1);

stage.focus = buttonpushdown;

function downkeyhandler1(event:KeyboardEvent): void{
if(event.keyCode == Keyboard.DOWN)
{gotoAndPlay(1045)}
}