2 Replies Latest reply on Sep 12, 2007 7:20 AM by clbeech

    Actions for button

    simey70 Level 1
      Hello,

      I have created a button set, consisting of 9 buttons. I created the buttons on the stage, and on the over section of the button, i created a movie clip to animate them. All the animation is done, which includes a rollOVER animation, and a rollOUT animation, and the time line is labled up. I need some action script that will play the roll over animation on rolling over and the out animation on rolling out.

      Il predict that someon here will reply and tell me the best way to do this is create movie clips that act as buttons, but i have already created the buttons and im hoping there will be some action script that can do what i need.

      Hope someone can help. Thank you in advance :)
        • 1. Re: Actions for button
          mkayyali
          Hello Simey,

          on button :

          on (rollOver) {
          mc.gotoAndPlay ("rollOVER")
          }
          on (rollOut) {
          mc.gotoAndPlay ("rollOUT")
          }


          mc = the movieclip name
          • 2. Re: Actions for button
            clbeech Level 3
            the above is somewhat correct if you attach the code to the button instance, but if you are calling from the timeline you would use the syntax:

            my_btn.onRollOver = function() {
            this.rollOver_mc.play();
            }

            However, I do think you are going to run into problems. if the 'rollOver' animation mc appears only on the 'over' state fo the button, it will not exist at the time that the 'play' command is being called, or at least it will be inconsistant. Additionally, the same is true of the 'rollOut' animation, this should probably reside on the 'up' state.

            Also you should not need to invoke the animations if you have created them independantly and placed the MCs in the button states, they should just play from frame1 when the button's built-in handlers change to that state. if you have a single mc 'spanning' the button states, and do need to call to it, try some of the methods above, but I'll predict that you'll most likely have some problems :)