4 Replies Latest reply on Apr 4, 2012 6:46 AM by sinious

    Making buttons that stay down.


      Hi all,


      You've probably had this question many times and I've done some google searches but I'm new to actionscript so I'm still rather baffled.


      I have a document which is basically a catalogue page, and I'm trying to make it so that when you click on an image, a movieclip of the image fading in larger appears, so it will look essentially like it's been zoomed in. To do this I put the movieclip inside a button. I have the button working fine, when you click it, it does exactly what it's supposed to, but I have no idea how to set it so that when the button is clicked it stays in the 'down' position, so you don't have to hold the mouse down. And also how to get back to the main screen afterwards, since the movie does take up the entire stage when played.


      Is it possible to do this?


      Thanks a lot.

        • 1. Re: Making buttons that stay down.
          Ned Murphy Adobe Community Professional & MVP

          Either do not put the movieclip inside the button or use a movieclip instead of a button symbol.

          • 2. Re: Making buttons that stay down.
            sinious Most Valuable Participant

            MovieClips, Sprites, etc also can be clicked.


            Assuming you want to do a little coding as possible, create a new MovieClip and make it similar to the button. On frame 1 put the image in its default state. On frame 2 put the MovieClip you have of the image zooming. Now add a second layer to the MovieClip and click in frame 1. Open up the Actions Panel (Window->Actions or F9) and simply put a stop command in the actions panel:




            Not back out on the main timeline, click on your MovieClip (what used to be a button) so you have it selected. Look in the Properties Panel (Window->Properties) and in the upper right there is a white empty box. This is where you can 'name' your MovieClip so you can use it with ActionScript. Give it a name like: image1_mc


            Back on your main timeline add in a new layer (if you don't already have one) for actionscript (naming it 'actions' helps). On the frame where your MovieClip appears where you want it to zoom and act like a button, click on the actions layer you made and insert a blank keyframe. Add this code:


            image1_mc.addEventListener(MouseEvent.MOUSE_CLICK, clickHandler);


            function clickHandler(e:MouseEvent):void


                 if (MovieClip(e.target).currentFrame == 1)










            Should give you the basics of converting a button to a MovieClip and 'doing something' to it based on mouse over or mouse out. This will probably not be your desired effect because once you roll off the image it won't zoom back out. If you're comfortable with code there are much better ways of doing this with some AS Tweening. Although you'll start to get into dynamic positioning and I don't want to throw too much code in one post.

            1 person found this helpful
            • 3. Re: Making buttons that stay down.
              emmajones89 Level 1

              Thanks a lot, this is really helpful. I don't have a lot of ActionScript knowledge so it's probably best I start with something simpler.


              Thanks again, I appreciate the help.

              • 4. Re: Making buttons that stay down.
                sinious Most Valuable Participant

                You're welcome. If you have further button questions just shoot them out here.