您的位置:首页 > 其它

TypeError: Error #1010: 术语尚未定义,并且无任何属性。at mx.controls::List/createItemRenderer()[E:\dev\4.0.0\framew

2012-03-13 10:59 399 查看
纠结的错误,有时候出现有时候不出现==

百度到解决方法,贴出原文。。。

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的设置提到最开始,将两者分离,解决该问题。这算回避了问题的根本,还没有找到真正的解决方案。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐