我有这个ItemRenderer
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="false">
<s:HGroup verticalAlign="middle">
<s:Button label="{data.Nome} ({data.Rating})" width="150" height="35"/>
<s:Button label="{data.Estado}" width="150" height="30"/>
</s:HGroup>
</s:ItemRenderer>
我希望在键入data
时看到.
对象的属性,因为它是自定义对象。我怎么能看到他们?
data
被认为是User
类对象。
答案 0 :(得分:1)
试试这个
<fx:Script>
<![CDATA[
import yourPackage.User;
[Bindable]
private var user:User;
override public function set data(value:Object):void{
super.data = value;
user = data as User;
}
]]>
</fx:Script>
<s:HGroup verticalAlign="middle">
<s:Button label="{user.Nome} ({user.Rating})" width="150" height="35"/>
<s:Button label="{user.Estado}" width="150" height="30"/>
</s:HGroup>
答案 1 :(得分:0)
要么ЮрийБорыс说,要么你也可以将数据投射为用户:
<s:Button label="{User(data).Nome} ({User(data).Rating})" width="150" height="35"/>
HIH