I have been working with SwapDepths a lot lately and thought I should post some interesting findings about depth.
*MCD == MovieClipDatatype
1. SwapDepths accepts both a target and an integer. This is available in F5 and F6 Players.
_level0.createEmptyMovieClip('ted',0)
ted.swapDepths(34)
trace(ted.getDepth()) //output:34
2. IDE placed MCDs are positioned on negative depths (in F5 MCD's skipped every other depth)
// place a MCD on stage
// instance name = 'ted'
trace(ted.getDepth()) //output:"-16383"
// why 16383? 16383 == 2^14
3. Negative Depths are protected from the RemoveMovieClip. Change the depth to positive and it works.
// place a MCD on stage
// instance name = 'ted'
ted.removeMovieClip() // fails
ted.swapDepths(0)
ted.removeMovieClip() // gone!
4. In F5 Player, TextFields were placed on negative depths in the gaps between MCD depths. (Not true with F6, as TextField is more component oriented) I think this was done as a class oriented system where depth provided a Textfield certain methods and properties and allowed binding to a variable. Although this is just theory in regard to the F5 Player. Only MM knows...
5. SwapDepths work with _level#'s also but have some strange effects
// turn _level0 into _level16383 >>> NO MORE LEVEL0 ????? Tell me it ain't so! ;)
_level0.swapDepths(0)
// SwapDepth only works if _levels are occupied by a loaded MCD
_level30.swapDepths(_level2)
// You can swapDepths with _level0 content so long as the other _level is loaded
_level0.swapDepths(_level30)
6. For loops operate according to MCD depth (highest to lowest depth). Swap depths and the order will change.
_level0.createEmptyMovieClip('t1',0)
_level0.createEmptyMovieClip('t2',1)
_level0.createEmptyMovieClip('t3',2)
for (var prop in _level0){
if(typeof(_level0[prop]) == 'movieclip'){
trace(prop)
}
}
//output:t3
//output:t2
//output:t1
t1.swapDepths(t3)
for (var prop in _level0){
if(typeof(_level0[prop]) == 'movieclip'){
trace(prop)
}
}
//output:t1
//output:t2
//output:t3
Cheers!
ted ;)
DIGG IT! 
0 Responses to “ Fun with SwapDepths ”
Post a Comment