六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 46|回复: 0

List绑定Array并删除Array项的bug

[复制链接]

升级  88%

10

主题

10

主题

10

主题

童生

Rank: 1

积分
44
 楼主| 发表于 2013-1-26 13:35:27 | 显示全部楼层 |阅读模式
做了一个组件,用途是从左边的List中选择某些项,点击按钮,添加这些项到右边List,并将其从左边List删除。
两个List的数据源都是Array。用splice方法删除选中的项。
 
问题: 在选择较多项时(大概40+),报如下错误:
 
Error: Invalid index: '68'.
    at mx.collections::ListCollectionView/http://www.adobe.com/2006/flex/mx/internal::getBookmark()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1021]
    at ListCollectionViewCursor/get bookmark()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1699]
    at mx.controls.listClasses::ListBase/updateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:3711]
    at mx.controls::List/updateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\List.as:1005]
    at mx.controls.listClasses::ListBase/validateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:3344]
    at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
    at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:695]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8744]
    at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8684]
 
找了很久,也不知道问题在哪儿。(如果你知道,请告诉我,多谢)
 
就用ArrayCollection 替换了Array作为数据源,相应的方法替换为removeItemAt。
没错误了。。。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表