s:List ,如何清除它的内容

发布于 2024-12-11 20:31:22 字数 44 浏览 2 评论 0原文

我里面有孩子,我想知道如何从内容中清除它,动态添加后删除所有孩子。 谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

三生一梦 2024-12-18 20:31:22

您可以只设置一个空的 dataProvider - list.dataProvider = new ArrayCollection();

另一种方法是清空现有的 dataProvider: list.dataProvider.removeAll();

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

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

神经大条 2024-12-18 20:31:22

您可以使用 ListListid.removeAllChildren() 函数简单地删除所有子项。

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

拿命拼未来 2024-12-18 20:31:22

如果您有 arraycollection 使用:
myAC.removeAll;其中 myAC 是您的 arrayCollection 的 id。

但也许你正在使用数组?
然后使用函数:

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

我希望这有帮助:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文