3 Replies Latest reply on May 9, 2006 6:21 PM by Craig Grummitt

    Nested movie clips and actionscript

    zenos
      I have this code set up:
      /* This is to get the rollover menu movie clip */
      this.profile_button.onRollOver = function(){
      profile_button.gotoAndStop("on");
      }
      /* This is to get rid of the rollover menu */
      this.profile_button.onRollOut = function(){
      profile_button.gotoAndStop("off");
      }
      /* This tells where to go when someone clicks on menu 1 */
      this.profile_button.profile_menu_1.onRelease = function() {
      gotoAndStop("5");
      }
      /* This tells where to go when someone clicks on menu 2 */
      this.profile_button.profile_menu_2.onRelease = function() {
      gotoAndStop("10");
      }

      This is on the main timeline and menu_1 and _2 are in the Profile_button movie clip. When I export I get the drop down menu but when I click on the menu items it won't do anything. Any help would be much appreciated. Thanks.
        • 1. Re: Nested movie clips and actionscript
          Craig Grummitt Level 3
          You've got a couple of problems with your code that i could see from a quick look.
          You've got buttons inside a movieclip that also has button event handlers. once a parent(eg profile_button) has a button event handler (eg onRollOver), any children (eg profile_button.profile_menu_1) don't get notified of any button events.
          Also - do your menu buttons(eg profile_menu_1) only appear when you rollover profile_button? if so, then you can't setup your menu buttons where you have. you would have to wait until they are physically on stage.
          good luck!
          • 2. Re: Nested movie clips and actionscript
            zenos Level 1
            They are all movie clips, but I do understand what you are saying. What would be a good workaround. I have tried using the invisible button mouseout, but when I have several of the buttons together it doesn't dissappear because it is activating the rollover event for the next image.

            I am not familiar with Load Movie Clips, but would that be an option?
            • 3. Re: Nested movie clips and actionscript
              Craig Grummitt Level 3
              i'm not sure what direction you were going with loading a Movie Clip, but there are many ways you could go here, depending on what sort of effect you would like as well. One simple way is that you could have an invisible button underneath profile_button that covers the screen which acts to remove the menu buttons(and itself) on rollover. So in other words, rather than profile_button.onRollOut, you're doing more like anything other than profile_button.onRollOver... make sense? if that doesn't work for you, you could check mouse coordinates every x milliseconds by setting an interval...