I want to assign message field property of IconItemRenderer using actionscript. Initially i did:
<s:List id="numberList" width="100%">
<itemrenderers:IconItemRenderer messageField="number" labelField="label"/>
When I tried to set messageField using actionscript like this:
(numberList.itemRenderer as IconItemRenderer).messageField = "url";
this gave me null exception.
What I think here is, itemRenderer property of List provides a Class type instance which can not be typecast into IconItemRenderer. So what is the solution for this.
As I undestand right, List create itemRenderer's instance for every row. So, when you set messageField in mxml, you setted it for all intstances of itemRenderer at initialization. At runtime, you may change messageField property only in concrete instance of itemRenderer, but not in all.
I don't know your goals, so can you give only general advice: