Created
December 18, 2012 17:43
-
-
Save edgarberm/4330174 to your computer and use it in GitHub Desktop.
Bring to front any DisplayObject AS3
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
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