3 Replies Latest reply on Mar 28, 2007 12:58 PM by kglad

    Actionscript Error

    flashmakesmemad
      I've been working with actionscript for a while now, but I don't know what to do with this! I'm trying to make an ultra simple mouseover effect using the movieclip.onRollOver method.

      IT WONT WORK

      It's a movieclip inside a movieclip. The movieclip I want to animation onRollOver is called aboutStaff_mc, found in dropdown_mc. I made sure I spelled everything correctly in it, checked the instance names, but nothing will work. Here's what I've tried:

      In the main timeline, Actions layer:

      dropdown_mc.aboutStaff_mc.onRollOver = function() {
      dropdown_mc.aboutStaff_mc.gotoAndStop(2);
      };


      Inside dropdown_mc, Actions layer:

      aboutStaff_mc.onRollOver = function() {
      aboutStaff_mc.gotoAndStop(2);
      };


      On the movieclip itself:

      on(rollOver) {
      gotoAndStop(2);
      }


      Also, I've tried testing it with onRollOut and onRelease in all three places, all with no effect. I did make all the codes work, however, with dropdown_mc (eg. dropdown_mc.onRollOver, etc.)
        • 1. Re: Actionscript Error
          kglad Adobe Community Professional & MVP
          if you have mouse handlers for a parent movieclip, no child movieclip will respond to mouse events because the parent intercepts them.

          to remedy, define mouse handlers for the youngest generation that needs handlers or use a hitTest() for one of the generations.
          • 2. Actionscript Error
            flashmakesmemad Level 1
            Yeah, that was the problem. I found out that another movieclip I was using with onRollOut interfered with this (when I removed the onRollOut, it worked).

            The two movieclips are on top of each other...

            Any ideas on how to make the onRollOut work with the onRollOver (for two different movieclips?)
            • 3. Re: Actionscript Error
              kglad Adobe Community Professional & MVP
              you have two options: define mouse handlers for the youngest generation that needs handlers or use a hitTest() for one of the generations.

              you can always do both. which works best for you depends upon your set-up.

              generally avoiding the hitTest() is preferred because you need to use a loop to continually check the hitTest() results.

              but defining mouse handlers for the youngest generation can be challenging unless you're an experienced actionscripter.

              a quick way to do this is to place a movieclip or movieclips (with alpha zero) on the parent stage whereever you want "hotspots" to respond to the mouse, in addition, to the child movieclips that are already there.

              on the timeline that contains the parent movieclip, you can then use: