Created
February 27, 2014 02:17
-
-
Save martinwells/9243014 to your computer and use it in GitHub Desktop.
dump a sprite stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function dumpSpriteStack(sprite:Sprite) | |
{ | |
trace(spriteToString(sprite)); | |
var parent:Sprite = cast sprite.parent; | |
var c = 1; | |
while (parent != null) | |
{ | |
var indent = '.'; | |
for (i in 0...c) | |
indent += '.'; | |
c++; | |
trace(spriteToString(parent)); | |
parent = cast parent.parent; | |
} | |
} | |
public function spriteToString(sprite:Sprite):String | |
{ | |
return sprite.name + ' @' + sprite.x + ',' + sprite.y + ' (' + sprite.width + 'x' + sprite.height + ') alpha:' + sprite.alpha + | |
' vis:' + sprite.visible + ' scale:' + sprite.scaleX + 'x' + sprite.scaleY; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment