5 Replies Latest reply on Jun 11, 2010 6:57 PM by celebritymusic

    how to trigger function when certain keys inputted in text field?

    celebritymusic Level 1

      Gidday

       

      I have a stage listener for keyboard events, that triggers one of two error checking functions for text field inputs depending on which movieclip the fields are in.  Text fields in certain movieclips trigger a function that checks if the entry is between a certain numerical range, whereas the textfields in the other movieclips test to make sure the text fields aren't left empty.

       

      It works fine apart from me not accounting for keyboard events other than letters, numbers and punctuation, or, among others, the Shift key.

       

      So what's happening now is that keyboard events outside of numbers, letters and punctuation are triggering an output error.

       

      Just wondering how to remedy this?

       

      The listener I'm using is:

       

      stage.addEventListener(KeyboardEvent.KEY_UP, KeyPressed);

       

      KeyPressed is a function that determines which error checking function to run depending on which movieclip window is open.

       

      Thanks your your help on this one.

       

      Shaun