Browse Source

Shortcut to remove all sprite children

deepnight 9 years ago
parent
commit
6cc432f16d
1 changed files with 5 additions and 0 deletions
  1. 5 0
      h2d/Sprite.hx

+ 5 - 0
h2d/Sprite.hx

@@ -272,6 +272,11 @@ class Sprite {
 		}
 	}
 
+	public function removeChildren() {
+		while( numChildren>0 )
+			removeChild( getChildAt(0) );
+	}
+
 	// shortcut for parent.removeChild
 	public inline function remove() {
 		if( this != null && parent != null ) parent.removeChild(this);