11-26-2010 07:45 AM
hi friends..
i m using sprite object to display the items...
while deleteing objects using removeChild() method from a group of objects, the object is deleted which is created last...
i want to remove all the objects from the sprite...
anybody knows share here..
thanks
Solved! Go to Solution.
11-26-2010 08:12 AM
Have you tried to put all controls (or fields) in one container (or sprite) to have only one item to remove? This seems more object oriented, but you may use numChildren property which will inform you how many childrens this object has (then just use removeChildAt counting from number of childs towards to one).
11-26-2010 01:06 PM
Some containers have a removeAllChildren() method, otherwise, you will need to do what gluth suggested:
while( this.numChildren > 0 )
{
this.removeChildAt( 0 );
}
11-27-2010 12:03 AM
thanks my friend...
but that routine clear all the objects in the sprite or the display container...
i want to delete the objects except the last created...
i will try in stack concept...
tks...
11-27-2010 10:40 AM
In that case, you can do:
while( this.numChildren > 1 )
{
this.removeChildAt( 0 );
}