1 Reply Latest reply on Sep 15, 2006 11:55 AM by TimSymons

    Trying to simulate button click via ActionScript

    pinion247 Level 1
      Hello,

      I've got code written to tell if a user is hitting his/her left or right arrow keys. I currently have a "next" button named realNext, and a "back" button named realBack. Both buttons have lots of code written in their on(release) functions. How can I utilize ActionScript to simulate a button click?

      Here's my code thus far:

        • 1. Re: Trying to simulate button click via ActionScript
          TimSymons Level 1
          I have never had success **** this by calling the onRelease or onPress event functions. So to get around this I define other functions that do all of the work and then just use the onRelease and onPress event functions as callers.

          For example.

          button1.onRelease = myFunction;

          function myfunction():Void {
          // code goes here
          }

          Now with this I can either press the button to ge thte code executed or I can "simulate" the button being pushed by just calling myFunction().

          Tim