3 Replies Latest reply on Jun 5, 2006 8:14 AM by happyjeans

    On click ActionScript

    Level 7

      I am trying to put a simple ActionScript on a next button, so I can goto the
      next scene of my project. But I have absolutely no idea how to do it, can
      anyone help me?


        • 1. Re: On click ActionScript
          blemmo Level 1
          There are 2 ways of doing this:
          A) select the button and open the actionscript panel (F9). The capture of the window should be "Actions - Button". Now insert this:
          // code

          B) select the button and open the properties window (ctrl+F3). Give it an instance name in the textfield. Now select the frame on the timeline that holds the button and open the actions window. The capture should be "Actions - Frame". Insert this:

          instancename.onRelease = function(){
          // code

          I'd recommend the 2nd option, because that way you can have all code in frames and don't have to search through the buttons to find it. Another advantage: you could delete or change the action later, what you cannot do with the 1st way.
          I'd also recommend against using scenes, they can be tricky to handle sometimes. You can use labeled frames instead, and use goto with the frame labels, this is better if you have some interaction in your movie.

          • 3. Re: On click ActionScript
            The easiest way would be to use the behaviours panel (shift + f3) make sure the button is a button (right click - convert to symbol). Select the button, and in the behaviours panel click the blue plus in the left hand top corner. Go to movieClip and 'goto and stop at frame or label' In the popup box, at the bottom, select the frame you want to go to. (this way you don't have to right any code yourself)

            If you are having problems with the animation playing all the frames one after another, and you want it to stop at the first frame for example. Put "stop();" in the actionscript pane of the frame you want it to stop and wait at.