3 Replies Latest reply on Mar 17, 2007 7:44 AM by jgn2006

    Buttons in nested MovieClips

    jgn2006 Level 1
      Forum,

      I'm making a zoomable and panable graphic and I have used four nested MCs as follows: main_mc->zoom_mc->pan_mc->content_mc. Main is top level and contains everything, zooming is done on zoom_mc, panning on pan_mc and my content is in content_mc. The zooming and panning works perfectly. The trouble I run into is that the buttons in content_mc do not respond and this I believe is because they are shadowed by the events on the higher MCs. I need them in this MC because I want the buttons to pan and zoom too. What is the mechanism here and is there any way of dealing with this? I live my buttons to respond when I rollover and click them and also be able to pan and zoom using the other MCs. I would not mind being able to switch the panning/zooming on and off to enable the buttons to work when needed. Is this asking too much of it? Any ideas appreciated.
        • 1. Re: Buttons in nested MovieClips
          kglad Adobe Community Professional & MVP
          child (or descendant) movieclips cannot respond to mouse events if mouse handlers have been assigned for a parent (or ancestor) moviecip because those mouse events are intercepted.

          to remedy define all your handler for the youngest generation that needs a handler or use a hitTest() for one of the generations.
          • 2. Re: Buttons in nested MovieClips
            SymTsb Level 2
            You'd be correct.

            MC1 Zoom / MC2 Pan
            MC3 MC with buttons

            Because MC1 and 2 have actions attached to them, any actions associated with the MC3, will effectively be ignored or rather, be inaccessible. The way to handle this is checking for bounds on the same level as the MC1 and 2 and delete their handlers so that MC3s handlers become accessible. When you're done with the handlers (outside the bounds of being able to do so) you just recreate the pan and zoom handlers. There is a tutorial at gotoandlearn.com that can show you exactly how something like this is done with a thumbnail scroller. try that if it is at all possible in your setup
            • 3. Re: Buttons in nested MovieClips
              jgn2006 Level 1
              Thanks for quick response. What I had in mind is to use a button at the top level to toggle between handlers in MC1 and MC3 removing them when I need to access MC3. Just not sure how to do it. Let me check the tutorial you suggest.