2 Replies Latest reply on Jul 18, 2007 1:40 PM by miquael

    Simple button function issue

    miquael Level 1
      Why won't this work?

      meta_nav.bm0.onRollOver = function () {
      meta_nav.bm0.gotoAndStop("state2");
      }

      I've double checked to be sure all instance names and frame labels are correct. And have tested the same function with bm0 on the _root level, and this works fine:

      bm0.onRollOver = function () {
      bm0.gotoAndStop("state2");
      }

      What am I missing to call a function to an MC nested within another MC?

      I've also tried this:

      _root.meta_nav.bm0.onRollOver = function () {
      _root.meta_nav.bm0.gotoAndStop("state2");
      }

      And this:

      _root.meta_nav.bm0.onRollOver = function () {
      myNodeButton = _root["meta_nav.bm0"];
      myNodeButton.gotoAndStop("state2");
      }

      No luck.
        • 1. Re: Simple button function issue
          Rapatski
          Hey Michael, you're very close the solution yourself. Instead of trying to addressing scope in a absolute fashion (_root), try the relative approach.

          When you nested this videoclip, _root does not point to this movieclips timeline anymore, but to the root of the movieclip it is nested in. See it as that you added a ground level story to your house, lifting the old house, and see the front door as something on root level. In this case, you do not want to take the stairs down, but remain on the first etage.

          this.meta_nav.bm0.onRollOver = function () {
          this.gotoAndStop("state2");
          }

          try tracing some this-es to find out what scope your current function has.
          • 2. Re: Simple button function issue
            miquael Level 1
            Well thanks for the help. Somehow, I actually got my original treatment to work (accidentally, after messing around with some other MCs within meta_nav). Still not sure what was actually wrong.

            Currently, this is on the _root level timeline (not nested), and is working:

            meta_nav.bm0.onRollOver = function () {
            meta_nav.bm0.gotoAndStop("state2");
            }

            So in this case, when I applied "this", it stopped functioning,

            I appreciate your perspective in any case, as the entire Flash file I am working on is meant for importation into another SWF framework--so your advice may come in handy.

            ~ Thanks