From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike Nimer
Sent: Friday, July 28, 2006 10:18 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?
> categories = event.result as ArrayCollection;
this is creating new objects
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(event.result) " Your actually doing "new ArrayCollection( SomeArrayCollectionVariable )" And the ArrayCollection constructor doesn't support creating a new ArrayCollection from an existing ArrayCollection.
So things that would work:
Casting
categories = event.result as ArrayCollection;
categories = ArrayCollection(event.result); // notice the lack of the "new" keyword.
Create new
categories = new ArrayCollection( (event.result as ArrayCollection).souce ); // the .source property of the ArrayCollection is a proper Array.
hope that made sense,
---nimer
From: Mike Anderson <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Thursday, July 27, 2006 5:10:25 PM
Subject: RE: [flexcoders] How does Flex 2.0 handle ColdFusion Query results?
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?
Hello Shannon :)Yes, I am doing precisely that. I was trying to avoid posting code, but it's the easiest way to show you everything I am trying to do. You can assume too, that yes I am bringing back a valid RecordSet from ColdFusion, and the FieldNames match up exactly with what was brought back. Since the data is all there, Flex for some reason, is not iterating through all the data and parsing it out properly. I just have a hard time with this - since this works fine with my Flash Remoting app, and that I am bringing back a native Query Object from ColdFusion. I must be missing something, or am not properly casting something. As far as I can tell, I am properly coding the Grid Columns - but maybe I am not... One last thing - I am running something similar to Flash's NetConnection Debugger - and I am for sure getting back a valid response from the CF Server - an Array of Objects, all properly formatted and casted.If you could shed further light, as to why no data shows up in my DataGrid when the app runs, I'd be very grateful :)
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
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___