1 Reply Latest reply on Mar 23, 2016 2:24 PM by ClayUUID

    Capture the keyboard input of the second keystroke

    pedrom48110900

      I need the capture the keyboard input of the second keystroke (and ignore the first one), which I need to be "0" or "1" to play the movie.

      At the first time it works fine, but after my movie returns to the beginning, the keystrokes aren't recognized anymore...

      Below is the script for this part. Maybe something is wrong with the way it ignores the first keystroke?

       

      import flash.events.KeyboardEvent;

        stage.addEventListener(KeyboardEvent.KEY_DOWN, reactToKeys);

        function reactToKeys(keyEvent: KeyboardEvent): void {

        if (barCodeFirst == 1) {

       

        if (keyEvent.keyCode == 48) {

        trace("zero");

       

        } else if (keyEvent.keyCode == 49) {

        trace("one");

       

        } else {

        trace("nope");

        }

       

        } else {

        (barCodeFirst = 1);

        }

        }