6 Replies Latest reply on Oct 25, 2007 11:26 AM by kglad

    Root 3.0 Sucks

    Noah_B
      Hello everyone. I've been working with actionscript for a loooooong time, but not 3.0. I'm working with two movie clips, making one reference another through the main timeline, to create a nice button interactivity.

      Now comes the problem, what the f*** happened to my simple _root.movieclip.gotoAndPlay();?

      I have the button set as:
      image1.addEventListener(MouseEvent.CLICK, image1play);

      calling the function:
      function image1play(event:MouseEvent):void {
      root.images.gotoAndPlay("image1");
      }

      where images is the id of the movieclip on the root timeline.

      Needless to say, this doesn't work. If anyone can help me I would greatly appreciate it.
        • 1. Re: Root 3.0 Sucks
          kglad Adobe Community Professional & MVP
          cast root as a movieclip.
          • 2. Re: Root 3.0 Sucks
            Noah_B Level 1
            I'm sure that is great advice, and I thank you very much for responding, but I'm new to AS 3.0, so I am unsure of how to cast root as a movieclip. How would I go about doing that? Would it be so simple as renaming the scene as root?
            • 3. Re: Root 3.0 Sucks
              crila Level 1
              MovieClip(this.parent.parent).gotoAndPlay("image1");

              that should work. Sometimes you have to add or take away a .parent depending on what level the movie clip is at.

              i want the old syntax back myself.
              • 4. Re: Root 3.0 Sucks
                Level 7
                > i want the old syntax back myself.

                Ehh, well ... heavy reliance on _root was never an especially good thing
                By the same token, loathsome hatred of _root wasn't good either (my
                opinion). It was (is) just a tool in the AS2 toolkit. In any cases, the
                _root reference isn't necessary, given how scope works in AS2. Same goes
                for AS3, though scope has changed for event handlers like the one shown.


                David Stiller
                Co-author, Foundation Flash CS3 for Designers
                http://tinyurl.com/2k29mj
                "Luck is the residue of good design."


                • 5. Re: Root 3.0 Sucks
                  Noah_B Level 1
                  Thank you very much. That helped a lot. I just can't seem to get used to the new syntax with AS3, but I'm sure it will be worth the effort in the end.

                  For anyone trying to find the answer to this problem, here is what it came out to be.

                  MovieClip(this.parent).images.gotoAndPlay("image1");

                  MovieClip(this) - We are talking about the current movie clip
                  .parent - Look up one level, to add more levels simply add more ".parent"
                  images - name of the movieclip you are looking for
                  gotoAndPlay("image1") - go to and play the specified point of "image1"
                  • 6. Re: Root 3.0 Sucks
                    kglad Adobe Community Professional & MVP
                    and you could have used: