Я пытаюсь заполнить <mx:List>
dataProvider, который я получил по запросу мыла.
я получаю следующую ошибку, когда пытаюсь добиться этого:
TypeError: Error #1034: Type Coercion failed: cannot convert AchivementsItemRenderer@1906a851 to mx.controls.listClasses.IListItemRenderer.
at mx.controls::List/createItemRenderer()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\List.as:1987]
at mx.controls::List/http://www.adobe.com/2006/flex/mx/internal::getMeasuringRenderer()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\List.as:1896]
at mx.controls::List/commitProperties()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\controls\List.as:911]
at mx.core::UIComponent/validateProperties()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\core\UIComponent.as:7387]
at mx.managers::LayoutManager/validateProperties()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\managers\LayoutManager.as:572]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\managers\LayoutManager.as:700]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1069]
Если я использую тот же dataProvider на <mx:Repeater>
, он работает без проблем.
чего мне не хватает?
mxml файл
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:local="*" backgroundColor="#aabbcc" fontSize="11" creationComplete="init()">
`
public var soap:SoapMyService = new SoapMyService();
[Bindable]
public var myData:Array;
public function handleSoapResult(event:GetMyResultEvent):void {
myData=event.result;
}
public function updateData():void {
soap.getData(528);
}
public function init():void {
soap.addgetMyDataEventListener(handleSoapResult);
updateData();
}
]]>
`
<mx:List id="myList" height="157" width="160"
itemRenderer="theItemRenderer"
baseColor="#323232" dataProvider="{myData}" >
</mx:List>
</mx:VBox>
Рендерер предметов
<?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/halo"
xmlns:local="*">
<s:states>
<s:State name="normal"/>
<s:State name="hovered"/>
<s:State name="selected" />
</s:states>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:HGroup verticalAlign="middle" paddingTop="0" paddingBottom="0">
<mx:Image source="http://www.xpogames.com/{data.img}" width="50" height="40" alpha.hovered=".5"/>
<s:Label text="{data.username}" color.hovered="0x1313cd" color.selected="0x000000" verticalAlign="bottom"/>
</s:HGroup>
</s:ItemRenderer>