Ver Fonte

added getChildIndex

ncannasse há 11 anos atrás
pai
commit
24ee94c188
1 ficheiros alterados com 7 adições e 0 exclusões
  1. 7 0
      h2d/Sprite.hx

+ 7 - 0
h2d/Sprite.hx

@@ -320,6 +320,13 @@ class Sprite {
 	public inline function getChildAt( n ) {
 		return childs[n];
 	}
+
+	public function getChildIndex( s ) {
+		for( i in 0...childs.length )
+			if( childs[i] == s )
+				return i;
+		return -1;
+	}
 	
 	inline function get_numChildren() {
 		return childs.length;