Hi there,
In my application, I have TileList with a image and label in each
tile. The image and label is retrieved from a xml file.However, when I
run the project it fails and points to default FaultHandler function.
On further debugging, I realized that length of XML data returned from
HTTPService is 0. So the httpservice is unable to hit the xml
file..right ?
here is 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:Script>
<mx:HTTPService id = "srv" url="data/catalog.xml" useProxy="false"
result="xmlLoaded(event)" resultFormat="e4x" />
Can you please throw some light on what must have gone wrong.
Also, if the dataprovider for TileList is srv.LastResult.catalog, it
seems to load the label but not image ( image is replaced by a small
cross ).
Thanks,
Kshama
---------- Forwarded message ----------
From: "[email protected]" <[email protected]>
Date: May 10, 4:56 am
Subject: fault event occurs on httpservice call
To: Flex India Community
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
-~----------~----~----~----~------~----~------~--~---