1 Reply Latest reply on Dec 3, 2008 5:39 PM by Ned Murphy

    Can we substitute Key.isDown for onRelease?

    Level 7
      How do I give a string like this
      if(Key.isDown(Key.SHIFT)){

      this kind of function:
      icon1_mc.onRelease = function(){

      ???

      in other words, I want the Shift key (or other keys) to trigger an effect only
      when released. This would be especially helpful as I use numbers for sorting
      arrays etc. and key.isdown often causes the numbers to move in greater than 1
      increments between clicks.

        • 1. Can we substitute Key.isDown for onRelease?
          Ned Murphy Adobe Community Professional & MVP
          See if you can figure out what you need to use/modify out of this help files snippet (try it first to see what it does):

          var keyListener:Object = new Object();
          keyListener.onKeyDown = function() {
          trace("DOWN -> Code: "+Key.getCode()+"\tASCII: "+Key.getAscii()+"\tKey: "+chr(Key.getAscii()));
          };
          keyListener.onKeyUp = function() {
          trace("UP -> Code: "+Key.getCode()+"\tASCII: "+Key.getAscii()+"\tKey: "+chr(Key.getAscii()));
          };
          Key.addListener(keyListener);