2 Replies Latest reply on Aug 10, 2007 3:25 PM by gmatteson

    On Mouse Click

    gmatteson
      How would I go about using actionscript to code when a user clicks on a button it goes to frame 2?

      on (mouseDown) {
      gotoAndStop(2);

      I tried this on the button but no luck, thank you for any help.
      - Gabe
        • 1. Re: On Mouse Click
          Damon Edwards Level 3
          on(release){
          gotoAndStop(2);
          }

          however, you should get away from that style of coding.. Give your button an instance name, click it once and down in the property inspector you will see <instance name>, click there and type my_btn.. then click on a frame and open the actions panel, make sure in the upper left corner it says "Actions-Frame", then paste this in there

          my_btn.onRelease = function(){
          gotoAndStop(2);
          };
          • 2. Re: On Mouse Click
            gmatteson Level 1
            Thank you! That was very helpful. Sorry if this is a novice question, but can you explain to me the actions - frame part? Any code put here can be accessible on any layer and reference any object? Is there a benefit putting code here and not on the object e.g. button or graphic itself? Is it just cleaner? Thank you for any clarification you can provide.
            - Gabe