嘿我想在AS3中访问对象属性,我有很多对象的数组,例如老师,学生 我需要代码如何教师的访问属性,
private function init():void
{
//action is ArrayCollection contains teacher object and student object
action=new ArrayCollection();
action=srv.getData(id);
}
在List
中获取ArrayCollection时,我的问题就在这里<s:List id="list" dataProvider="{action}">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer labelField="What should I write ?? to access Teacher Name"/>
</fx:Component>
</s:itemRenderer>
</s:List>
答案 0 :(得分:0)
我解决了问题:)
将labelField更改为label ...
并写入label = {data.teacher.name}
<s:List id="list2" dataProvider="{action}">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer label="{data.teacher.Name}" />
</fx:Component>
</s:itemRenderer>
</s:List>