3 Replies Latest reply on Feb 14, 2013 6:29 AM by Ned Murphy

    Configuring a key to execute a button

    Rick Cesar

      Hi guys,

      i'm pretty sure this is quite simple to do, but i'm very newbie in Flash yet...

       

      I just wanna easy way to add a function integrated in my button script (in the timeline, not inside the button)

       

      e.g.: When i press "right arrow", it'll execute the "btn_next" button ("play();")

       

      at moment, my AS in the timeline is:

       

      stop();

      btn_next.onRelease = function(){

                play()

      }

      btn_recu.onRelease = function(){

                gotoAndStop(1)

      };

       

       

      i'm looking for something like:

       

      stop();

      btn_next.onRelease = function(){

          if(Key.isDown(Key.RIGHT)) {

                play();

          }

      }

      btn_recu.onRelease = function(){

          if(Key.isDown(Key.LEFT)) {

             gotoAndStop(1)

           }

      };

       

      This is obviously wrong, just an exemple!