|
Made perfect sense! Thanks for clearing that up... I didn't
know the answer, I just knew it worked :)
Shan From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Nimer Sent: Friday, July 28, 2006 10:18 AM To: [email protected] Subject: [Junk E-Mail - LOW] Re: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?
Your not
doing the same thing
this is
casting the object
> categories = event.result as ArrayCollection;
this is creating new objects >categories = new ArrayCollection( event.result as Array);
-or-
categories = new ArrayCollection( event.result)
Now why doesn't it work? The event.result variable is already an ArrayCollection. And if you look at the asdoc for the ArrayCollection constuctor, it takes an Array (An ArrayCollection object is NOT an Array ).
And when you do this
"new ArrayCollection(
So things that would work: Casting categories = event.result as ArrayCollection; categories =
ArrayCollection(
Create new categories = new
ArrayCollection( (event.result as ArrayCollection)
hope that made sense, ---nimer
-----
Original Message ----
From: Mike Anderson <[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 27, 2006 5:10:25 PM Subject: RE: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?
Hello Dave and All,
I checked out the Article and it
worked!!
But I am confused why it
worked... In some respects, I thought I was doing the same thing - but
just in a different way. I was wondering if you could explain why one
piece of code works, and the code I originally used did NOT work. For
the example code below, you can all assume that I already declared a
public variable called 'categories' , and cast it as an ArrayCollection.
..
For starters, here is the code that
works from the Article:
categories = event.result as
ArrayCollection;
And
for the code that does NOT work:
categories = new ArrayCollection( event.result as
Array);
-or-
categories = new ArrayCollection( event.result)
;
If I
understand your post correctly, you are saying that the "Event Object" performs
some type of "smart conversions" - only when it's being directly
assigned to a variable? And if that's true, this conversion never
gets triggered, when it's placed inside of a Constructor (for example an
ArrayCollection) ? This would explain why my code did not
work.
I
don't know - just thinking out loud here. I would love to know more about
how this all works, especially since there were so MANY massive changes from
Flex 1.0 Beta, all the way to the latest release version (not to mention Flash
Remoting, which the earliest versions of Flex had a lot of similarities
to). I am sure learning how this all works, will save me a LOT of
headaches down the road - especially since I ONLY write Data-Driven applications
(RIA's) which all make massive amounts of database
calls.
Thanks
for all your wonderful advice!
Mike
From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of Dave Carabetta Sent: Thursday, July 27, 2006 1:04 PM To: [EMAIL PROTECTED] ups.com Subject: Re: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?
Mike, A bit has changed between 1.5 and 2.0 with regard to Flex, and for the better (aka easier). To that end, yesterday I blogged a post on using Arrays vs. ArrayCollections in Flex and, at the bottom, there is a semi-complete MXML application that shows calling an HTTPService and handling the results for display in the DataGrid. In short, the new ResultEvent class should make its way into your code, as that class is the one that has the "smarts" to handle ColdFusion queries and cast it to an appropriate local data structure. Watch for link wrapping: http://www.cbetta. com/blog/ index.cfm/ 2006/7/26/ array-vs- array-collection -in-flex- 2-with-a- coldfusion- slant Hope this helps. Regards, Dave. -- -- 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
YAHOO! GROUPS LINKS
__,_._,___ -- |
- Re: [flexcoders] How does Flex 2.0 handle ColdFusion Query ... Mike Nimer
- RE: [Junk E-Mail - LOW] Re: [flexcoders] How does Flex... Shannon Hicks
- Re: [flexcoders] How does Flex 2.0 handle ColdFusion Q... Dave Carabetta
- RE: [flexcoders] How does Flex 2.0 handle ColdFusion Q... Mike Anderson

