Would it help to make your HTTPService resultFormat "e4x" and not use
mx:Model for categorienAC, but rather use an XMLList?
<mx:Script>
<![CDATA[
* var **categorienAC : XMLList = new XMLList();*
private function xmlLoaded():void {
categorienAC = srv.lastResult.categorien.categorie;
}
]]>
</mx:Script>
<mx:HTTPService id="srv" url="categorien.xml" useProxy="false"
result="xmlLoaded();" *resultFormat="e4x"*/>
Hope that helps,
Michael
rdeijkers wrote:
I'm trying to fill a Tile with the contents of an xml file. This is my
mxml code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml>"
layout="absolute" width="100%" height="100%" backgroundAlpha="0"
applicationComplete="srv.send();" horizontalScrollPolicy="off"
verticalScrollPolicy="off">
<mx:Script>
<![CDATA[
private function xmlLoaded():void {
categorienAC = srv.lastResult.categorien.categorie;
}
]]>
</mx:Script>
<mx:Model id="categorienAC"/>
<mx:HTTPService id="srv" url="categorien.xml" useProxy="false"
result="xmlLoaded();" />
<mx:Tile label="categorienTile" width="945" height="100%"
backgroundColor="#FFFFFF">
<mx:Repeater id="list" dataProvider="{categorienAC}">
<mx:VBox backgroundColor="#000000">
<mx:Image source="{list.currentItem.foto}" width="75" height="70"/>
<mx:Label text="{list.currentItem.naam}"/>
</mx:VBox>
</mx:Repeater>
</mx:Tile>
</mx:Application>
My XML looks like this:
<categorien>
<categorie id="19">
<naam></naam>
<omschrijving>test</omschrijving>
<foto></foto>
</categorie> <categorie id="1">
<naam>Arizona</naam>
<omschrijving>test</omschrijving>
<foto></foto>
</categorie> <categorie id="36">
<naam>ARIZONA / GREY</naam>
<omschrijving></omschrijving>
<foto></foto>
</categorie> <categorie id="20">
<naam>Atrium</naam>
<omschrijving>test</omschrijving>
<foto></foto>
</categorie> <categorie id="59">
<naam>Avant Garde</naam>
<omschrijving>test</omschrijving>
<foto></foto>
</categorie>
</categorien>
I'm receiving the following error when I try to execute my code :
TypeError: Error #1034: Type Coercion failed: cannot convert
mx.collections::[EMAIL PROTECTED] to mx.utils.ObjectProxy.
at categorie/categorie::xmlLoaded()[Z:\project\categorie.mxml:6]
Anybody an idea what's going wrong ?
Anyhelp would be greatly appreciated.
Thanks
Regards
Ries