5 Replies Latest reply on Aug 26, 2007 8:13 AM by kglad

    depth problem

    DZ-015 Level 1
      Hey - things are getting messed up with the depth of my code... The code is attached below, here is the output I get from the first two times I run it. Good readings the first time, crap readings after that... Any idea why?


      output:
      topBackground: bkAll, depth: -16377
      newBackground: bkAll, depth: -16377
      topBackground: bkAll, depth: -16377
      newBackground: bkAll, depth: -16377
      ----------------
      topBackground: bkAll, depth: undefined
      newBackground: bkInterior, depth: undefined
      topBackground: bkInterior, depth: undefined
      newBackground: bkInterior, depth: undefined
      ----------------
        • 1. Re: depth problem
          DZ-015 Level 1
          incidentally, the commenting out of the swapDepths() method doesn't change anything... I think I'm calling it wrong or something... Are there any conditions that have to be met for it to work?
          • 2. Re: depth problem
            kglad Adobe Community Professional & MVP
            you're out of scope when fadeOutBackground() is called after the first time. ie, "this" is undefined which is typical with a setInterval() function call.

            but i don't understand how an object (topBackground, for example) traces its instance name and not its absolute path.
            • 3. Re: depth problem
              DZ-015 Level 1
              i just switched it around... used movieClip data types for topBackground and newBackground instead of strings, that way scope is less important.

              A bit round-a-bout, but it worked. Thanks for the insight though - yea, it was acting funny.
              • 4. Re: depth problem
                clbeech Level 3
                you also can't swap depths with something that's at the same depth, you could assign them depths and then shuffle them around. If you swap to a depth that has something existing at that depth, it will be replace by the new item.
                • 5. Re: depth problem
                  kglad Adobe Community Professional & MVP
                  you're welcome.