I did further debugging and realized that when length of XMLList is
traced, it returns 0. Thus, httpservice is not returning data from xml
file at all.
Here is snippet of the code:
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var itemlist :XMLList;
private var itemlistcoll : XMLListCollection
private function xmlLoaded(evt:ResultEvent):void {
itemlist = evt.result.catalog;
trace( itemlist.length());
}
<mx:HTTPService id = "srv" url="data/catalog.xml" useProxy="false"
result="xmlLoaded(event)" resultFormat="e4x" />
However , when I use <httpservice id>.lastresult.catalog as a
dataprovider to TileList, it loads the Tile with label but not the
image ( image is replaced by cross).
Any idea why XML data is not returned ?
Kshama
On May 10, 4:56 am, "[email protected]" <[email protected]>
wrote:
> Hello,
>
> In my application, I have TileList with a image and label in each
> tile. The image and label is retrieved from a xml file.
>
I use :
> <mx:HTTPService id = "srv" url="data/catalog.xml"
> useProxy="false" result="itemhandler(event)" resultFormat="e4x" />
>
> to load the xml file.
>
> However, when I run the project it fails and points to default
> FaultHandler function. But, if I alter the url or change the location
> of xml file, then too it fails, but it indicates that error is in
> itemHandler. I am unable to understand why this is happening.
>
> is something wrong in url . Here is rough sketch of my folder
> structure:
> /src
> /data
> -catalog.xml
> /components
> - shop.xml
> -itemview.xml
> /images
> -image1.jpg
>
> (Note : I have also tried using src/data/catalog.xml as url)
>
> I wasnt getting the error earlier, when most of object declaration was
> in the main application. I restructured my project, to keep it more
> organized and then the error start occurring.
>
> Here is the code :
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="932"
> height="400" creationComplete="srv.send()">
> <mx:Script>
> <![CDATA[
> import mx.rpc.events.ResultEvent;
> import mx.collections.XMLListCollection;
>
> [Bindable]
> public var itemlist : XMLListCollection;
>
> private function itemhandler(evt:ResultEvent):void
> {
> itemlist = evt.result..item;
> trace(itemlist)
> }
>
> ]]>
>
> </mx:Script>
> <mx:HTTPService id = "srv" url="../data/catalog.xml"
> useProxy="false" result="itemhandler(event)" resultFormat="e4x" />
>
> <mx:Model id="catalog" />
>
> <!-- Using inline item renderer -->
>
> <mx:TileList id="ItemDisplay" rowCount="3" columnCount="3"
> rowHeight="150" columnWidth="150" dataProvider="{itemlist}"
> width="100%" height="97%" y="0" x="0" verticalScrollPolicy="auto"
> visible="true">
> <mx:itemRenderer>
> <mx:Component >
> <mx:VBox width="50" height="50"
> horizontalAlign="center" clipContent="false" verticalAlign="middle" >
> <mx:Image source="{'images/'+
> data.image}" height="100" width="100" />
> <mx:Label text="{data.name}"
> textDecoration="underline" fontStyle="italic" fontThickness="11"
> fontWeight="bold"/>
> </mx:VBox>
> </mx:Component>
> </mx:itemRenderer>
>
> </mx:TileList>
> </mx:Canvas>
>
> Please advise.
>
> Kshama
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---