Alon
Alon

Reputation: 3906

s:List , how to clear it's contents

I have with children inside it and I wanted to know how do I clear it from contents, delete all children after they were added dynamically. Thanks.

Upvotes: 0

Views: 1006

Answers (3)

Vladimir Tsvetkov
Vladimir Tsvetkov

Reputation: 3013

You can just set an empty dataProvider - list.dataProvider = new ArrayCollection();

Another way is to empty the existing dataProvider: list.dataProvider.removeAll();

Upvotes: 1

Misiu
Misiu

Reputation: 4919

If You have arraycollection use: myAC.removeAll; where myAC is id of Your arrayCollection.

But mayby You are using array? Then use function:

public function removeArrayElementsWithPop(aArray:Array):void
{
   const sizeArray:int = aArray.length;
   for ( var index:int =0 ; index < sizeArray; index++ )
     {
        aArray.pop();
     }
}

I hope this helps :)

Upvotes: 0

Shebin
Shebin

Reputation: 3468

You can simply remove all the children by using the Listid.removeAllChildren() function of List.

Upvotes: 0

Related Questions