Hi Ravi,
I got this working...here is the code :
***************************************************************
[Bindable]
private var itemXML : XML;
[Bindable]
private var itemlist :XMLList;
[Bindable]
private var itemlistcoll : XMLListCollection
public function xmlLoaded(evt:ResultEvent):void {
itemXML = new XML(evt.result);
itemlist = itemXML.item;
itemlistcoll = new XMLListCollection(
itemlist);
// itemimage = new
XMLListCollection(itemlist.image);
}
I think I had to convert the result in to XML even though the result format
was e4x.
Thanks for looking into it.
Kshama
On Tue, May 12, 2009 at 4:23 PM, Kshama Pawar <[email protected]>wrote:
> hey there...
>
>
> i had sent u my xml file...but anyways here it is again..( see attached
> too)
>
>
>
> <?xml version="1.0"?>
> <catalog>
> <item>
> <name>mug_1</name>
> <description>Borland cofee mug 1</description>
> <price>3</price>
> <category>Cofeemugs</category>
> <image>images/mug_1</image>
> <color>white</color>
> </item>
> <item>
> <name>mug_2</name>
> <description>Borland cofee mug 2</description>
> <price>3</price>
> <category>Cofeemugs</category>
> <image>images/mug_1</image>
> <color>black</color>
> </item>
> <item>
> <name>mug_3</name>
> <description>Borland cofee mug 3</description>
> <price>3</price>
> <category>Cofeemugs</category>
> <image>images/mug_1</image>
> <color>Red</color>
> </item>
> <item >
> <name>off_supply3</name>
> <description>Scratch Pad</description>
> <price>3</price>
> <category>Office Supplies</category>
> <image>images/mug_1</image>
> <color>Red</color>
> </item>
>
> <item>
> <name>off_supply1</name>
> <description>Glowing Clips</description>
> <price>3</price>
> <category>Office Supplies</category>
> <image>images/mug_1</image>
> <color>Yellow</color>
> </item>
>
> <item >
> <name>off_supply2</name>
> <description>Glowing Clips</description>
> <price>3</price>
> <category>Office Supplies</category>
> <image>images/mug_1</image>
> <color>Yellow</color>
> </item>
>
>
> <item >
> <name>off_supply1</name>
> <description>Glowing Clips</description>
> <price>3</price>
> <category>Office Supplies</category>
> <image>images/mug_1</image>
> <color>Yellow</color>
> </item>
>
> <item >
> <name>T-Shirt</name>
> <description>Graphic Tee</description>
> <price>7</price>
> <category>Casual Wear</category>
> <image>images/mug_1</image>
> <color>Yellow</color>
> </item>
>
> <item >
> <name>T-Shirt2</name>
> <description>Spring Collection</description>
> <price>6</price>
> <category>Casual Wear</category>
> <image>images/mug_1</image>
> <color>Blue</color>
> </item>
> </catalog>
>
>
>
>
>
> Also : I tried again with ArrayCollection...it does return data ( i checked
> the length)..But I am not yet sure on how it will bind data to tile list.
>
> Anyways, let me know if you are able to collect the results from
> httpservice in XML format.
>
>
>
>
>
> Kshama
>
>
>
>
>
>
>
> On 5/12/09, Ravi Mishra <[email protected]> wrote:
>>
>> Kshama,
>>
>>
>>
>> U again misunderstood me J
>>
>>
>>
>> From the format of XML I did not meant its encoding format. I just meant
>> to look at the structure of the xml you are using. That is:
>>
>>
>>
>> <root>
>>
>> <node>
>>
>> </node>
>>
>> </root>
>>
>>
>>
>> So just send me that and then I will try that at my end.
>>
>>
>>
>> -Ravi
>>
>>
>>
>> *From:* Kshama Pawar [mailto:[email protected]]
>> *Sent:* Tuesday, May 12, 2009 6:05 PM
>> *To:* [email protected]; [email protected]
>> *Subject:* Re: [flex_india:22146] Re: Fwd: fault event occurs on
>> httpservice call
>>
>>
>>
>> Hey there...
>>
>> Any luck on this issue? ...
>>
>> Ravi,
>> I just re-read your e-mail. You had asked format of xml- it was ANSI but
>> later I tried converting it to UTF-8 ( and also unicode). But that did not
>> help.
>>
>> Few other things I tried :
>>
>> 1.Using UrlLoaderr/URLRequest- It returns no data.
>> 2. I create a XML variable in the actionscript it self. But that to was
>> not returning the data in the first child.
>>
>> I was started thinking it could be Flash Player issue. Currently I am
>> using Flash Player 10.
>>
>> Input appreciated.
>>
>> Kshama
>>
>> On Mon, May 11, 2009 at 8:17 AM, Kshama Pawar <[email protected]>
>> wrote:
>>
>> sure..please see attached.
>>
>> Kshama
>>
>>
>>
>> On Mon, May 11, 2009 at 1:55 AM, Ravi Mishra <[email protected]>
>> wrote:
>>
>>
>> Kshama,
>>
>> Can you plz send the format of the XML you are trying to parse?
>>
>> -Ravi
>>
>> On May 10, 9:56 pm, "[email protected]" <[email protected]>
>> wrote:
>>
>> > 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
-~----------~----~----~----~------~----~------~--~---