xltank 发表于 2013-1-26 13:35:27

List绑定Array并删除Array项的bug

做了一个组件,用途是从左边的List中选择某些项,点击按钮,添加这些项到右边List,并将其从左边List删除。
两个List的数据源都是Array。用splice方法删除选中的项。
 
问题: 在选择较多项时(大概40+),报如下错误:
 
Error: Invalid index: '68'.
    at mx.collections::ListCollectionView/http://www.adobe.com/2006/flex/mx/internal::getBookmark()
    at ListCollectionViewCursor/get bookmark()
    at mx.controls.listClasses::ListBase/updateDisplayList()
    at mx.controls::List/updateDisplayList()
    at mx.controls.listClasses::ListBase/validateDisplayList()
    at mx.managers::LayoutManager/validateDisplayList()
    at mx.managers::LayoutManager/doPhasedInstantiation()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()
    at mx.core::UIComponent/callLaterDispatcher()
 
找了很久,也不知道问题在哪儿。(如果你知道,请告诉我,多谢)
 
就用ArrayCollection 替换了Array作为数据源,相应的方法替换为removeItemAt。
没错误了。。。
页: [1]
查看完整版本: List绑定Array并删除Array项的bug