1 Reply Latest reply on Jun 1, 2010 12:13 PM by Planet Mondo

    How to use keyboard events to trigger a button rollover event instead of a mouse?

    Planet Mondo

      I created a button that has a movieclip in the rollover state. When you rollover the mouse, the movieclip will animate to appear as if the button will scale from a small to a large button even though it is the movieclip that is playing and not the button itself. But I also want to add a keyboard code to play the rollover instead of the mouse. I learned to write actionscript to play different scenes with the code below, but I'm not sure if I can play a button rollover with the same code.

       

      stage.addEventListener(KeyboardEvent.KEY_DOWN, key_pressed);

      function key_pressed(event:KeyboardEvent):void {

      if (event.charCode==49) {

      gotoAndPlay(1,"scene");

      }