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

纠结的错误,有时候出现有时候不出现==

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

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的设置提到最开始,将两者分离,解决该问题。这算回避了问题的根本,还没有找到真正的解决方案。

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值