Flash & ActionScript3: remove Child Display Objects from Sprite( MovieClip)

Trabla: Flash & ActionScript3 - remove Child Display Objects from Sprite( MovieClip)

Solving:

....

var sprite:Sprite = new Sprite();

//Adding TextField to Sprite
for( var i:int = 0; i  < 3 ; i++ ){

     var tf:TextField = new TextField();
     sprite.addChild( tf );
}

var childrenNumber = sprite.numChildren;

//Removing Sprite children
for( var i:int = 0; i  < childrenNumber ; i++ ){
 
     sprite.removeChildAt(  );

}
....

No comments:

Post a Comment