It depends on the structure of the data returned by your WS. Most of
them contain a top-level object above any array-like structure, so you
may need to do something like this:
<mx:ArrayCollection id="myProvider"
source="{wsAlice.findUsers.lastResult.nameObject}"/>
HTH,
Ben
--- In [email protected], <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> I believe I'm following the docs precisely (the "Binding a
> result to an ArrayCollection object doc" in the Flex IDE
> Help), but my app isn't working. What I'd like to do is map
> the results of a web service call into an ArrayCollection, but
> the ArrayCollection comes up empty when I try.
>
> My app (below) demonstrates this problem, but unfortunately
> all of my data is password protected and I can't open it up.
> Here's what you'd see if you had access: When you enter an id
> into the box, the grid marked "Uses the data provider
> directly", the Name data is populated as it should be. But the
> one that is supposed to be populated by my ArrayCollection is
> empty.
>
> Can anyone comment on how to map the data from a web service
> into an ArrayCollection?
>
> -Kaylea
>
> <?xml version="1.0" encoding="utf-8" ?>
>
>
> <mx:Application xmlns:af="*"
> xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
> width="960">
>
> <mx:Script>
> <![CDATA[
> import mx.controls.Alert;
> import mx.utils.ArrayUtil;
> import flash.events.*;
>
> public function
> submitFindUserHandler(event:MouseEvent):void {
> var temp:String = new String();
> temp = lookup.text;
> wsAlice.findUsers.send(temp, "");
> }
> ]]>
> </mx:Script>
>
> <mx:WebService id="wsAlice" showBusyCursor="true"
> destination="wsAlice"
>
wsdl="https://parakeet.uchicago.edu:8443/ReservationsWebService/ReservationsWebService?wsdl"
> useProxy="false">
> <mx:operation name="findUsers">
> <mx:request>
> <userName></userName>
> <name></name>
> </mx:request>
> </mx:operation>
> </mx:WebService>
> <mx:ArrayCollection id="myProvider"
>
> source="{mx.utils.ArrayUtil.toArray(wsAlice.findUsers.lastResult)}"/>
>
> <mx:Panel x="95" y="69" width="646" height="435"
> layout="absolute">
> <mx:DataGrid x="10" y="206"
> dataProvider="{wsAlice.findUsers.lastResult}">
> <mx:columns>
> <mx:DataGridColumn headerText="First Name"
> dataField="firstName"/>
> <mx:DataGridColumn headerText="Last Name"
> dataField="lastName"/>
> </mx:columns>
> </mx:DataGrid>
> <mx:DataGrid x="345" y="206" dataProvider="{myProvider}">
> <mx:columns>
> <mx:DataGridColumn headerText="First Name"
> dataField="firstName"/>
> <mx:DataGridColumn headerText="Last Name"
> dataField="lastName"/>
>
> </mx:columns>
> </mx:DataGrid>
> <mx:TextInput x="92" y="96" id="lookup"/>
> <mx:Text x="260" y="98" text="CNetID"/>
> <mx:Button x="92" y="126" label="Look It Up"
> click="submitFindUserHandler(event)"/>
> <mx:Text x="21" y="180" text="Uses the data provider directly"/>
> <mx:Text x="324" y="180" text="Uses a variable copy of the
> data provider"/>
> </mx:Panel>
>
> </mx:Application>
>