4 Replies Latest reply on Oct 4, 2007 9:44 AM by Newsgroup_User

    _level0, _root, _parent

      So in particular, I have a sound that I'm loading externally and I'm trying to start it on a particular frame within a nested movie clip. I've tried _level0.batsSound.start(); as well as _root.... and both work locally, but neither work when I upload to my server. All the paths are correct, the variable is set correctly too, but it's just not wanting to work. Any thing else I can try?
      //on frame 1 of Scene 1
      var batsSound:Sound = new Sound();
      batsSound.loadSound("sounds/Bats.mp3", false);

      on frame of movieclip
      _level0.batsSound.start();

      the path to the movieclip is: house_mc.belfry_mc.bats_mc
      I've been able to get other sounds to load that are NOT nested so deep, and I've tried adding the code in to the main timeline actions, but this has not worked for me yet.

      Any ideas? Gracias

        • 1. Re: _level0, _root, _parent
          Level 7
          ekora,

          > I've tried _level0.batsSound.start(); as well as _root....
          > and both work locally, but neither work when I upload
          > to my server.

          This makes it sound as if one of your SWFs, at least, is getting loaded
          into another at runtime. I can't think of another reason why _level0 or
          _root would seem to change what they refer to. (The fact that both can seem
          to change meaning is enough to keep many developers from using those
          prefixes.)

          See this URL for a bit more detail:

          http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil

          If this works locally:

          > on frame of movieclip
          > _level0.batsSound.start();

          but this is added to the mix:

          > the path to the movieclip is: house_mc.belfry_mc.bats_mc

          ... then code in bats_mc may need to reach back two or three parents.

          // e.g.
          this._parent._parent.batsSound.start();
          // or
          this._parent._parent._parent.batsSound.start();

          Does that make sense?


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. _level0, _root, _parent
            clbeech Level 3
            yeah, I don't get it either unless it's being loaded in. But try ...

            _parent._parent._parent.batsSound.start();

            ...and see if you can get it to connect.

            EDIT: crap Dave!!! I just now saw the bottom part of your post, LOL!!! sorry :)
            1 person found this helpful
            • 3. Re: _level0, _root, _parent
              You guys RAWK! It worked.
              • 4. Re: _level0, _root, _parent
                Level 7
                ekora,

                > You guys RAWK! It worked.

                Glad to here that. :) More importantly, though, do you understand why
                it worked?


                David Stiller
                Contributor, How to Cheat in Flash CS3
                http://tinyurl.com/2cp6na
                "Luck is the residue of good design."


                1 person found this helpful