Skip to content

Instantly share code, notes, and snippets.

@edgarberm
Created December 18, 2012 17:43
Show Gist options
  • Save edgarberm/4330174 to your computer and use it in GitHub Desktop.
Save edgarberm/4330174 to your computer and use it in GitHub Desktop.
Bring to front any DisplayObject AS3
function bringToFront(obj:DisplayObject):void
{
var pos:Number = this.getChildIndex(obj);
while(pos < this.numChildren - 1)
{
var next:DisplayObject = this.getChildAt(pos + 1) as DisplayObject;
this.swapChildren(obj, next);
pos = this.getChildIndex(obj);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment