My reply to Juan P. Marsano post
On Mar 31, 2:49 pm, ashok <[email protected]> wrote:
> If this is what you are looking for.
>
> This example using htttrequest, resultformat="XML", if your result
> format is default(i.e, object) just bind the list dataprovider to
> serv.lastResult.users.student, it should work.
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="vertical">
>
> <mx:Script>
> <![CDATA[
> import mx.rpc.events.ResultEvent;
> import mx.events.ListEvent;
> import mx.events.ItemClickEvent;
>
> [Bindable]
> private var listData:XML;
>
> /* */
> private function onItemClick( event:ListEvent ):void
> {
> trace(event.currentTarget.selectedItem.data)
> }
>
> /* */
> private function onResult( event:ResultEvent ):void
> {
> listData = XML(event.result);
> }
> ]]>
> </mx:Script>
>
> <mx:HTTPService id="serv" url="assets/data.xml" resultFormat="xml"
> result="onResult( event )"/>
>
> <mx:List
> creationComplete="serv.send()"
> dataProvider="{listData.student}"
> labelField="label"
> itemClick="onItemClick( event )"/>
> </mx:Application>
>
> On Mar 30, 9:04 pm, GAGAN anand <[email protected]> wrote:
>
> > Hi Juan
>
> > You can create an associative Array Collection from the XML.
>
> > Then pass this Array Collection as a dataprovider to the List.
>
> > Hope it works.
>
> > Regards
> > Gagan Deep
>
> > 2009/3/30 GAGAN anand <[email protected]>
>
> > > Hi Juan
>
> > > You cannot assign a XML as a dataprovider to the list. First of all, you
> > > have to convert this XML to an Array Collection which you will pass as a
> > > dataprovider to the list.
>
> > > This will help you in achieving what u want.
>
> > > HTH
>
> > > Regards
> > > Gagan Deep
>
> > > 2009/3/30 Juan P. Marsano <[email protected]>
>
> > >> Hi guys, I need some help with a flex app. I have a php script that
> > >> returns an xml like this:
>
> > >> <users>
> > >> <student>
> > >> <label>StudentName1</label>
> > >> <data>StudentID</data>
> > >> </student>
> > >> <student>
> > >> <label>StudentName2</label>
> > >> <data>StudentID</data>
> > >> </student>"
> > >> </users>
>
> > >> I have been trying to load this info into a List, so that the list loads
> > >> both the label and de data, but I havent had any success. I have also
> > >> tried returning from php something like this:
>
> > >> <users>
> > >> <student label="StudentName1" data="1"/>
> > >> <student label="StudentName2" data="2"/>
> > >> </users>
>
> > >> To make myself clear, I need to use data from php as a data provider for
> > >> a list, so that the list gets both a label and data associated with the
> > >> label.
>
> > >> Any help?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---