2 Replies Latest reply on Mar 11, 2008 6:48 AM by C-Rock

    Disable arrow key until sound finishes playing

    twistedpancreas
      Hi there,

      I'm trying to make the UP arrow key disabled until a sound has finished playing. Is this possible?

      This is because other keys also play sounds and I don't want the sounds overlapping each other. Thus I'd also be trying to disable those keys as well whilst a sound is playing.

      Thanks in advance

      My code so far is:

        • 1. Re: Disable arrow key until sound finishes playing
          twistedpancreas Level 1
          The only other thing i've found that comes close is below but it doesnt seem to be working either. :(

          function noKeyboard() {
          _global.KeyPressed = Key.getCode();

          if(_global.KeyPressed != "avgbnm45678") {
          Key.getCode = "not letting you use keyboard";
          }else{
          Key.getCode = "still not letting you use the keyboard";
          }
          setInterval(noKeyboard, 5);
          • 2. Re: Disable arrow key until sound finishes playing
            C-Rock Level 2
            create two functions one called enableButtons and disableButtons. in each function just add a listener for the keys and remove the listener for the keys. or have a variable set on the root like useKeys:Boolean = false; and inside your on press function just have it say if(_root.useKeys != false){ put the code for a key being pressed. and the else could be "still not letting you use the mouse". when the sound is finished then it could change the useKeys variable to true.