TypeError: Error #1010: 术语尚未定义,并且无任何属性。at mx.controls::List/createItemRenderer()[E:\dev\4.0.0\framew
2012-03-13 10:59
399 查看
纠结的错误,有时候出现有时候不出现==
百度到解决方法,贴出原文。。。
The problem occurs when you are forced to reset the dataProvider for the list and the itemRenderer for the list at the same time. So, if your code looks like this:
You will probably get the above error.
What you want to do instead is use the List's callLater() method to set your dataProvider. Your code will now look like this:
Now, I am not entirely sure how this function works, but what I imagine is that this function will call the function specified once the list is ready to accept a dataProvider. ??Again though, I am not entirely sure how it works… I just know that it does.If
anyone else has some insight on the callLater() method, please drop some comments to explain.
文中所给的解决方法在我这里行不通,但让我知道引发错误的原因是同时修改了列表的dataProvider和itemRenderer,后来想了一下,其实我的itemRenderer一直没变只是重新设置了dataProvider,故将itemRenderer的设置提到最开始,将两者分离,解决该问题。这算回避了问题的根本,还没有找到真正的解决方案。
百度到解决方法,贴出原文。。。
Error #1010: A term is undefined and has no properties.at mx.controls::List/createItemRenderer()
It turns out that there is a weird quirk with the Flex List control and custom itemRenderers.The problem occurs when you are forced to reset the dataProvider for the list and the itemRenderer for the list at the same time. So, if your code looks like this:
myList.dataProvider = myDataProvider; myList.itemRenderer = new ClassFactory(MyRenderer);
You will probably get the above error.
What you want to do instead is use the List's callLater() method to set your dataProvider. Your code will now look like this:
myList.itemRenderer = new ClassFactory(MyRenderer); myList.callLater(myFunction); private function myFunction():void{ myList.dataProvider = myDataProvider; }
Now, I am not entirely sure how this function works, but what I imagine is that this function will call the function specified once the list is ready to accept a dataProvider. ??Again though, I am not entirely sure how it works… I just know that it does.If
anyone else has some insight on the callLater() method, please drop some comments to explain.
文中所给的解决方法在我这里行不通,但让我知道引发错误的原因是同时修改了列表的dataProvider和itemRenderer,后来想了一下,其实我的itemRenderer一直没变只是重新设置了dataProvider,故将itemRenderer的设置提到最开始,将两者分离,解决该问题。这算回避了问题的根本,还没有找到真正的解决方案。
相关文章推荐
- TypeError: Error #1010: 术语尚未定义,并且无任何属性
- Flex 术语尚未定义,并且无任何属性 gc.refresh();
- iview在IE报TypeError: 无法获取未定义或 null 引用的属性transfer
- python list转换字符串报错TypeError: sequence item 0: expected str instance, int found
- Eclipse error : Failed to create the part's controls
- sencha touch2---直接用xxtype定义的组件无法使用该实例的方法;必须要用create
- List添加Item时, 如何去判断某个字段, 并且保证字段数据不重复性
- “SCRIPT5007: 无法获取属性“nodeName”的值” 或 “TypeError: a is undefined”
- Python Numpy ValueError: data type must provide an itemsize
- DropDownList中ListItem的扩展属性
- underscore.js定义模板遇到问题:Uncaught TypeError: Cannot read property 'replace' of undefined
- 请确保此代码文件中定义的类与“inherits”属性匹配.并且该类扩展的基类(例如 Page 或 UserControl)是正确
- 47902376209184:error:0D0DC0C6:asn1 encoding routines:ASN1_item_sign_ctx:digest and key type not supp
- Flex4 主程序调用模块方法报TypeError: Error #1009:无法访问空对象引用的属性或方法
- List添加Item时, 如何去判断某个字段, 并且保证字段数据不重复性
- Ul、Li的list-style-type 属性
- List添加Item时, 如何去判断某个字段, 并且保证字段数据不重复性
- TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::DataGrid@9a7c0a1 转换为 spark.core.IViewport。
- Using a CheckBox control as a list item renderer in Flex
- TypeError: sequence item 0: expected str instance, int found的解决办法