I completely agree with what Ryan says, but if you still
want to use getNextHighestDepth(), as Nathan
commented, you could do something like this and get a
similar result:
...getNextHighestDepth() + 10;
No! Bad bad bad! Now you *really* have no way to find your objects. Why
not just do this:
getNextHighestDepth()+10*152/36%23*Math.random()*362;
... it would be equally as useful. The whole idea is that you keep
things at *predictable*, and whenever possible explicitly defined, depths so
that things are easy to manage. If you need getNextHighestDepth, that means
you don't know what the current highest depth being used is, and that means
you aren't in control of the z-depth of your objects. That's a bad thing. At
any given time, you should be able to say "I know that objects A, B, C, and
D are at depths 35, 36, 37, and 38, so it is safe to put this new object at
40," and so on. And even better is to set constants in the class that
defines those objects, that way you can just add a new constant for the new
object, and you can see what the other depths are for reference when you are
defining it.
ryanm
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders