View Full Version : getting an result from cfc and flash remoting
fou99004
12-06-2007, 11:05 PM
I don't know how many here program in a coldfusion environment but I am pretty sick of creating an array of structs just so I can get a proper associative array in flash. Is there a new data object in AS3 that will automatically build this assosiative array for me? Sort of like a recordset? I've looked but I haven't found anything yet. I'm just trying to save myself and the server some time.
I also realize that I could just pass the query results to flash and then just build out my object by dynamically matching serverInfo.initialData to serverInfo.columnNames but I was hoping there was a dataType built into AS3 that did this. When I was programming in a .NET environment I didn't have a problem with this.
Nomad2000
12-06-2007, 11:22 PM
ActionScript 3.0 has a Dictionary class.
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Dictionary.html
fou99004
12-07-2007, 05:02 PM
I've looked at your link, which wasn't very helpful to me, and at a blog post by gskinner at http://gskinner.com/blog/archives/2006/07/as3_dictionary.html
Other than garbage collection, I don't see how the Dictionary class can help me or be very helpful for anything really. Do you have any better links out there?
Nomad2000
12-07-2007, 05:53 PM
1. You said you want to build an "associative array". What do you think the Dictionary class is?
2. A Dictionary/Map/Associative array is a fundamental data computer science structure. How can you think it can't "be helpful for anything really"?
fou99004
12-07-2007, 08:06 PM
We are getting off topic. If you have any examples of where a Dictionary structure is used, send me a link because I am curious and am always willing to learn a new tool that I can use.
Let me try to ask my question better.
When I was dealing with .NET and flash remoting I could say:
var oResult:Object = re.results;
The associative array was taken care of for me through a .NET structure that was returned to me.
In coldfusion I don't have this convinience as far as I can tell. To get this same functionality I need to either return an array of structs which is a lot of work in the CFC or, using the columnNames from the returned result object, match it to the initialData values which is a lot of work on the client side.
My question is: Is there a structure in AS3 that does this association for me? Do I need to do it manually, either on the CFC or in the actionscript?
Hope that explains my question better.
Jason
P.S. To answer your question, I think a Dictionary extends an Object(which is the associative Array) giving you the added feature of strict equality.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.