Skip to content

Instantly share code, notes, and snippets.

@martinwells
Created February 27, 2014 02:17
Show Gist options
  • Save martinwells/9243014 to your computer and use it in GitHub Desktop.
Save martinwells/9243014 to your computer and use it in GitHub Desktop.
dump a sprite stack
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