8 Replies Latest reply on May 2, 2006 12:44 PM by Rothrock

    Is there a function in AS which lists all the depth taken in the movieclip?

    Level 7
      Is there a function in AS which lists all the depth taken in the movieclip?


        • 1. Re: Is there a function in AS which lists all the depth taken in the movieclip?
          Level 7
          If you look up the movieClip.getDepth() method, in the help, there's a
          function that lists the depths of all clips on stage.

          --
          Dave -
          Adobe Community Expert
          www.blurredistinction.com
          www.macromedia.com/support/forums/team_macromedia/


          • 2. Re: Is there a function in AS which lists all the depth taken in the movieclip?
            Peter Lorent Level 2
            Not that I know of. But you could use MovieClip.getDepth()
            • 3. Re: Is there a function in AS which lists all the depth taken in the movieclip?
              Rothrock Level 5
              But most likely whatever you are thinking you need this for is not the way to go. There is probably a different approach. For what purpose or is it just curiosity?
              • 4. Re: Is there a function in AS which lists all the depth taken in the movieclip?
                Level 7

                "Rothrock" <webforumsuser@macromedia.com> wrote in message
                news:e37mdk$6sh$1@forums.macromedia.com...
                > But most likely whatever you are thinking you need this for is not the way
                to go. There is probably a different approach. For what purpose or is it
                just curiosity?

                Good question. The purpose is to make sure there is no collisions of depth
                when adding a new object.
                What are the techniques people use for that purpose?
                I am thinking about having a global variable which is incremented in every
                attachMovie


                • 5. Re: Is there a function in AS which lists all the depth taken in the movieclip?
                  Rothrock Level 5
                  Using a variable is most likely good. Many people also like to use getNextHighestDepth(), but if you use components that may be a bit surprising. Personally I've never really understood why folks seem to rely on it so much. There are millions of depths you can use so don't worry about it to much. I mean how many things are you really going to attach/duplicate/create/etc.? Really?

                  My own technique is generally to just get an idea of what I'm doing and then use specific areas for stuff. So if I'm making a thumbnail gallery or something perhaps I will make the background for each thumbnail at 100 and place the art at 500. That gives me more than enough depths to do all kinds of stuff in between or below should I find it necessary. In the parent clip that will contain all the thumbs I just start at 1000. There is never a time when I will have/need more that 8999 clips to be loaded at one time or even sequentially. (Not that I would run out of depths at 10,000, but I might also have some other things placed at that depth.
                  • 6. Re: Is there a function in AS which lists all the depth taken in the movieclip?
                    Rothrock Level 5
                    Also remember that depth 100 in one movieclip will not "collide" with depth 100 in another movieclip. So you don't need to worry about a truly _global variable/counter. Just keep it local to the function/clip etc. where you are attaching.
                    • 7. Re: Is there a function in AS which lists all the depth taken in the movieclip?
                      Level 7
                      I used to use this approach basing on unlimited numbers for depth and it
                      failed me.
                      I splitted all the possible objects into groups and allowd, say, 1000 for a
                      group.
                      Problem is that I have to remember these groups, then there are collisions
                      in a group, then a need for a new group appears and its depth needs to be
                      between the existing groups.
                      Also if I have a code spreaded in several included files, you add a new
                      depth it works in one final product and failed in others.
                      I therefore believe in need of a system to keep track of all the depth in
                      use

                      "Rothrock" <webforumsuser@macromedia.com> wrote in message
                      news:e37vc7$i9f$1@forums.macromedia.com...
                      > Using a variable is most likely good. Many people also like to use
                      > getNextHighestDepth(), but if you use components that may be a bit
                      surprising.
                      > Personally I've never really understood why folks seem to rely on it so
                      much.
                      > There are millions of depths you can use so don't worry about it to much.
                      I
                      > mean how many things are you really going to attach/duplicate/create/etc.?
                      > Really?
                      >
                      > My own technique is generally to just get an idea of what I'm doing and
                      then
                      > use specific areas for stuff. So if I'm making a thumbnail gallery or
                      something
                      > perhaps I will make the background for each thumbnail at 100 and place the
                      art
                      > at 500. That gives me more than enough depths to do all kinds of stuff in
                      > between or below should I find it necessary. In the parent clip that will
                      > contain all the thumbs I just start at 1000. There is never a time when I
                      will
                      > have/need more that 8999 clips to be loaded at one time or even
                      sequentially.
                      > (Not that I would run out of depths at 10,000, but I might also have some
                      other
                      > things placed at that depth.
                      >


                      • 8. Re: Is there a function in AS which lists all the depth taken in the movieclip?
                        Rothrock Level 5
                        I still think you are making it too complex. But then again I don't really know exactly your needs. However I think part of the solution is my secondary posting.

                        Remember that depths of different parents don't collide so a bit of careful organization should – at least to my way of looking at it – really simplify things. Since there are millions of user depths and I just don't know any Flash player that handles more than a few hundred clips very well I just can't imagine what gives so many people troubles. Certainly for giant scene renders in 3-D apps and all I could see it becoming difficult. But Flash isn't for that anyways!

                        In any event, getNextHighestDepth() might be for you!