3 Replies Latest reply on Aug 15, 2007 4:00 PM by Newsgroup_User

    Path issue as 2.0

    land-mine
      Hello everyone

      I have a datagrid setup in a movie clip that I will call movie1_mc, movie1_mc is loaded inside of another movie I will call movie0_mc (wich is my root).

      When I load the movie1_mc by itself all my acitons work fine. However when it is loaded inside movie0_mc it does not seem to load any values from it.

      I am guessing it has something to do with the path.

      Example:

      Code:
      msg=myDatagrid.getItemAt(1).myfield;
      -if I try this from movie1_mc it works fine.
      -When I try this from movie0_mc (the root wich contains "loader_mc" that loads movie1_mc) I get "undefined".
      I tried using:

      Code:
      msg=_root.loader_mc.myDatagrid.getItemAt(1).myfield;
      but this did not work either.

      Any ideas?
        • 1. Path issue as 2.0
          FlashTastic Level 1
          The problem is that the movie you're loading into _level1 has references to _root, which will always refer to _level0.
          You can easily solve this by setting the _lockroot property for your loaded movie to true.

          i.e. movie1_mc._lockroot = true;

          Cheers,
          FlashTastic
          • 2. Re: Path issue as 2.0
            land-mine Level 1
            thanks for the reply flash tastic, I must say I was pretty happy to see it. I hit a couple of forums before this and did not get any answers. go ADOBE
            I am sorry but I could not get that to work. Do I place that in the movie that is being loaded; or the one doing the loading.

            my main movie is called: canvis, in I have a loder: loader_mc. wich in turn loads: logins.swf

            Logins.swf is the one with the datagrid.

            Thanks
            • 3. Re: Path issue as 2.0
              Level 7
              >>Do I place that in the movie that is being loaded

              You lockRoot the movie you want to lock the root of... if that makes sense.
              Say you have two movies: a and b. In either movie _root references the root
              of that movie. Now lets say movie a loads movie b. Now within movie b _root
              reference movie a. This is because movie a loaded movie b and movie b is
              just another clip within movie a now. So if you lockroot in b, _root
              references the _root of b...

              While this will work, it's not a good solution. You should really never use
              _root as it leads to these kinds of problems. Instead you should know your
              hierarchy and reference the clips you need. And if you never put code
              anywhere but frame 1 of the main timeline this is much less an issue - it's
              not good practice to place code within clips or buttons, or anywhere but a
              script layer in frame 1. Besides these headaches, it makes your code hard to
              look through - ie messy... and messy code is bad code.

              --
              Dave -
              Head Developer
              http://www.blurredistinction.com
              Adobe Community Expert
              http://www.adobe.com/communities/experts/