2

我不知道,如果以下是可能的。

我确实有一个带有物品的煎茶触摸旋转木马。在某些时候,我想移除/销毁轮播,但不是该轮播中的物品。

据我所知,删除和销毁两者也会销毁添加到轮播中的项目。

有关解决问题的任何提示都会很棒。

4

1 回答 1

3

Remove 方法接受一个参数来防止删除的项目被破坏。在您的情况下,您可能想要使用removeAll(false).

// save items (not needed, but you probably need to keep a reference for later use)
var items = carousel.getItems();

// empty the carousel before destroying it
carousel.removeAll(false); // destroy set to false

// now you can dispose of the carousel
carousel.destroy();

// then, you'll probably want to add your items to another container...
otherContainer.add(items);
于 2013-06-07T11:41:53.737 回答