5 Replies Latest reply on May 22, 2006 7:58 PM by Newsgroup_User

    _root vs _levelN (_level0)

    Ian_Allen
      is there a definitive forum-post or article or whatever, about:
      understanding _root and _level0 and _levelN?

      for example: if a given SWF can loadMovie() another SWF into "level17", then can that 'child' movieclip say "_parent._root"
      to refer to something that might have loaded that 'first' SWF's movieclip -- which thinks it is "_root"?

      stuff like that...

      okay, then what if you have some wierd superFlash contraption that deeply loads SWFs so that nothing can be sure
      it is really the "main zero top root" timeline of anything?? what kind of code is necessary to climb all over the currently
      existing flash-rigamarole-structure-of-movieclips-loaded-by-other-movieclips, and know what the whole monster looks like (and facilitate communication between them)?

      [are we still in some kind of time-travelled past version of some kind of Flash 17.0, a future Flash which isn't so "Flash 4" about all this?] [[TELL TARGET always makes me think of apples and arrows and overtures.]]

      i'm not a programmer, but it sure seems that nothing but Flash has _levels and movieclips and timelines...
      and so there is no Java or C++ or Scheme paradigm or model for what is going on in Flash... i feel like i am learning the
      mechanics of something very high level, like say, Flex 17, for which Flash 8 is just a kind of nuts and bolts level...

      thus, there is indeed something quite special about being a Flash Mechanic, something not quite here yet.

      ian.
        • 1. Re: _root vs _levelN (_level0)
          Level 7
          > is there a definitive forum-post or article or whatever, about:
          > understanding _root and _level0 and _levelN?

          There is now...

          There are any number of levels in the flash player, that by default are
          layered/stacks so that level 0 is behind level 1, which is behind level 2
          etc.

          The first SWF movie you load goes into level 0 automatically. You can load
          other SWF's into other levels.

          _levelN refers to the root of the SWF movie loaded into level N.

          _root refers to the root of the SWF for the current level (ie the level that
          owns the object that owns the script that is currently executing)

          Its really not that hard ... have you read the help?

          > for example: if a given SWF can loadMovie() another SWF into "level17",
          > then
          > can that 'child' movieclip say "_parent._root"

          Its not a child movie clip then .. its a separate movie (not clip) playing
          in another level. It doesn't have a _parent

          > okay, then what if you have some wierd superFlash contraption that deeply
          > loads SWFs so that nothing can be sure
          > it is really the "main zero top root" timeline of anything??

          If you load into a level, it cannot be nested .. levels are a simple linear
          'stack' of movies, there is no nesting there.

          You can load a SWF into a movieclip (INSTEAD of into a level) .. then you
          can get nesting.

          > what kind of
          > code is necessary to climb all over the currently
          > existing
          > flash-rigamarole-structure-of-movieclips-loaded-by-other-movieclips,
          > and know what the whole monster looks like (and facilitate communication
          > between them)?

          _parent goes to immediate parent
          _root goes to highest level parent or parent or parent for the movie (the
          root timeline)
          _levelN goes to the _root for a given level number N

          > i'm not a programmer, but it sure seems that nothing but Flash has _levels
          > and
          > movieclips and timelines...
          > and so there is no Java or C++ or Scheme paradigm or model for what is
          > going
          > on in Flash...

          Its very much like levels = hard disks, _root is root (top level) folder on
          the disk, _parent is the '..' link to parent folder

          Anyone whoe programs anything more than very trivial will have similar
          structures of parents and children. Its got to be one of the most basic and
          useful paradigms in programming.

          > thus, there is indeed something quite special about being a Flash
          > Mechanic,
          > something not quite here yet.

          Not really .. you jsut have to 'get it'.
          --
          Jeckyl


          • 2. Re: _root vs _levelN (_level0)
            Ian_Allen Level 1
            thank you Jeckyl

            that did do it.

            1. every _levelN has its own _root
            2. _level0 is the _root of the main SWF that loaded first
            3. the _levelN are a simple linear 'stacking' structure

            -- ian.

            > _root refers to the root of the SWF for the current level (ie the level that
            > owns the object that owns the script that is currently executing)

            > _root goes to highest level parent or parent or parent for the movie (the
            > root timeline)

            > _levelN goes to the _root for a given level number N
            • 3. Re: _root vs _levelN (_level0)
              Level 7
              > thank you Jeckyl
              Glad to help
              --
              Jeckyl


              • 4. Re: _root vs _levelN (_level0)
                Ian_Allen Level 1
                great, so now i find....... _LOCKROOT

                !!
                viz:

                public _lockroot : Boolean

                A Boolean value that specifies what _root refers to when a SWF file is loaded into a movie clip. The _lockroot property is undefined by default. You can set this property within the SWF file that is being loaded or in the handler that is loading the movie clip.

                • 5. Re: _root vs _levelN (_level0)
                  Level 7
                  > great, so now i find....... _LOCKROOT

                  Yes .. that determines what _root means within a loaded SWF (when it is
                  loaded into another movie) .. does _root refer to the _root of the main
                  timeline of the level it is loaded into (at some nested place) .. OR does
                  _root refer to the _root of the main timeline of the SWF that was loaded (as
                  it is when the SWF is played on its own).
                  --
                  Jeckyl