3 Replies Latest reply on May 11, 2007 8:11 AM by Damon Edwards

    script not working

    Damon Edwards Level 3
      on (release, keyPress "<Enter>")

      the release is working, but hitting 'Enter' doesnt work.. is this the correct way to do this.
        • 1. Re: script not working
          dr_ross Level 1
          That codes a little bit old school, if this code is on a button or something and is the code to be actioned on release of that, then you want to check which key is down inside the handler.
          i.e.
          on(release)
          {
          if(Key.isDown(Key.ENTER))
          {
          trace("enter down");
          }
          }

          but if you want to perform an action when the enter button has been release independant of interacting with anything else then best bet is to adapt the code found in the Key.addListener section of the help file. Lot more detailed than a long article here.

          Hope that helped, Ade
          • 2. Re: script not working
            MurMeeKeer Level 1
            I agree that there are alternative ways but if 'keyPress"<Enter>"' doesn't work, then why should it be displayed in the pull down list?

            I think it as a different case.......

            A button alone is not able to detect the keyPress event.

            Have an input text field inside the button and click that field. The input cursor will be blinking. Now, pressing Enter will work fine.
            • 3. Re: script not working
              Damon Edwards Level 3
              i figured it out, I had to give the button a tabIndex along with the input fields to get <Enter> to work