Ohhhhh, this makes sense.
 
Thanks for the clarification - I was dealing with this problem too, and it all seems to work now, after I treat the result as an ArrayCollection right off the bat.
 
Thank you for your input on this,
 
Mike


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Nimer
Sent: Friday, July 28, 2006 9:56 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] ArrayCollection

>countries = event.result. countries as ArrayCollection;
In ColdFusion all queries are returned as a true ArrayCollection objects, so you don't need to create your own. So with this syntax you are just casting, or telling the compiler, the variable that you already know the datatype of (ArrayCollection) is an real ArrayCollection.

>countries = new ArrayCollection(event.result.countries as Array);
 
Here you are telling the compiler the result is an Array, so you need to *create* a new ArrayCollection object based on this array.
hth,
---nimer
 
----- Original Message ----
From: jtooley_1999 <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Friday, July 28, 2006 2:03:28 AM
Subject: [flexcoders] ArrayCollection

Hi all,

I am banging my head against the wall on this one.

We have an app that runs on two different servers.
One calls a CFC and uses <mx:RemoteObject>
The other one calls a java servlet using <mx:HTTPService> but they both
retrieve the same data.

With the CFC we are using remoting and we can access the data by going

public function geoResultHandler( event:ResultEven t):void
{
countries = event.result. countries as ArrayCollection;
// difference
blah blah blah... more code
}

and to call it
<mx:ComboBox id="theCountry" x="10" y="58" prompt="Please Select A
Country" dataProvider= "{countries} " labelField=" country_long"
change="setProvince ()" width="90%">

This works great.....

But with <mx:HTTPService> .. using that way returns null.. so we have to
use the following

public function geoResultHandler( event:ResultEven t):void
{
countries = new ArrayCollection( event.result. countries
as Array); // difference
blah blah blah... more code
}

<mx:ComboBox id="theCountry" x="10" y="58" prompt="Please Select A
Country" dataProvider= "{countries} " labelField=" country_long"
change="setProvince ()" width="90%">

Can anyone explain the difference of using a variable as an
ArrayCollection instead of declaring new ArrayCollection( )

Thanks
Jeremy Tooley


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to