Hello all,
I’m new to these forums and was going to ask a question as to why the following code did absolutely nothing:
a = _root.createEmptyMovieClip("", _root.getNextHighestDepth());
b = _root.createEmptyMovieClip("", _root.getNextHighestDepth());
ad = a.getDepth();
bd = b.getDepth();
trace("a depth: " + ad);
trace("b depth: " + bd);
b.swapDepths(ad - 1);
ad = a.getDepth();
bd = b.getDepth();
trace("a depth: " + ad);
trace("b depth: " + bd);
If you run this, you’ll notice that swapDepths does absolutely nothing, and prints the following:
a depth: 0
b depth: 1
a depth: 0
b depth: 1
I’d been searching Google for over 3 hours now, reading Adobe’s crappy documentation and tutorials everywhere (that’s what made me register here), but as I was waiting for the account activation mail to arrive, I wondered if perhaps the fact my MovieClips were unnamed was what was causing the problem…
So I gave it a try:
a = _root.createEmptyMovieClip("a", _root.getNextHighestDepth());
b = _root.createEmptyMovieClip("b", _root.getNextHighestDepth());
And what do you know?
a depth: 0
b depth: 1
a depth: 0
b depth: -1
Argh!!! pulls hair out
Well, if this helps anyone else out there trying to figure out why swapDepths is being braindead, then I’m glad I helped.