2 Replies Latest reply on Oct 7, 2010 2:22 PM by happyggv2

    Button does not work inside Movie Clip

    happyggv2 Level 1

      On the about page of my Flash website, I wanted 7 buttons to navigate to various labels. I just finished the first button. I made it while I was inside the about_mc. It worked well but would NOT navigate.  I took the button OUT of the Movie clip and made a separate layer on the about page for buttons and pasted it there and it worked perfect. When I made it inside the mc, is there some different code I should have used other than the standard code for making a button navigate to a frame. I built an addeventlistener and a function. BUT they only worked when the button was "ON TOP" of the mc NOT when it was INSIDE the mc. I have a transition tween on the about_mc and therefore the button does not tween when it is on TOP of the mc only when it is inside the mc. Any ideas ?


      var aboutTween:Tween = new Tween(about_mc, "y", Elastic.easeOut, -200, 146, 3, true);

      laborLaw1_btn.addEventListener(MouseEvent.CLICK, laborLaw1);

      function laborLaw1(evtObj:MouseEvent):void{

        • 1. Re: Button does not work inside Movie Clip
          vvirgill Level 1

          Hi There,


          Your original code should give you a compile error. It will not work because when you are adding an event listener for your button which is inside the movie clip, you need to specify the entire hierarchy to Flash. In other words this would have worked:


          about_mc.laborLaw1_btn.addEventListener(MouseEvent.CLICK, laborLaw1);

          function laborLaw1(evtObj:MouseEvent):void{


          Notice how I have added the about_mc which contains your button. If you don't include that, Flash is looking for that button on the stage, and cannot find it (because it's inside the about_mc).


          Let me know if that helped.



          • 2. Re: Button does not work inside Movie Clip
            happyggv2 Level 1

            TY so much Valerio, your explanation was clear and it worked just as you

            explained. TX again.


            BUT, here's what happened next. I am able to navigate back and forth between

            home and about (labor violations button) over and over again when I first

            play the swf.. Now, my Read More Details button works perfectly and

            navigates to laborLaw1_fl (frame 101) perfectly. Next, I made a button at

            101 to navigate BACK to the "about" and it works perfectly too. I used the

            following code in AS layer at 101 frame:



            //the following is to navigate back to "about" (Labor Page)

            closeLabor1_btn.addEventListener(MouseEvent.CLICK, returnLabor);

            function returnLabor(evtObj:MouseEvent):void{




            http://www.screencast.com/users/happyggv/folders/Jing/media/fa6092ff-e091-4856-865f-55b530 88a669


            THIS worked perfectly also EXCEPT that I can no longer navigate back to the

            home page from the about page (labor violations). I can navigate all day

            long before I execute the the navigation to 101 and come back and THEN my

            home button no longer works. Above is a link to seeing the problem in live

            action video. Hope I have explained this appropriately for you to make a

            determination about what I have done wrong. TY SO MUCH Gene






            The only issue IS: when I navigate BACK to the "about" (labor page), I can

            no longer navigate back to the home page.