This may or may not help you. Just a snippet of code from a project I did
over a year ago. It was also done w/o MG, so who knows. But I do remember
there being something funky about results passed to Flex.
I basically used the code as follows. The hasOwnProperty() calls checks to
be sure the values exist before attempting to use them.
private function RemoteResult(event:ResultEvent):void
{
var result:Object = event.result;
var i:Number;
if( result.hasOwnProperty('status') &&
result.hasOwnProperty('method') && result.status )
{
// If we have a query return, easier to use this way
// no harm if no query object returned, query will just
// be null.
var query:Object;
var queryArray:Array;
var queryArrayCollection:ArrayCollection;
if( result.hasOwnProperty("query") )
{
query = result.query;
queryArray = query as Array;
queryArrayCollection = query as ArrayCollection;
}
And in the CFC's
MG probably fixes this, but to be sure, here is a snippet of my external.cfc
<cfargument name="args" type="struct" required="no">
<cfset var results = StructNew()>
<cfset var copy = StructNew()>
<!--- fixes the fact that Flash doesn't send an argument args,
but is deflated one level and everything is a subset of
ARGUMENTS,
where ColdFusion uses the structured args tag --->
<cfif isDefined("ARGUMENTS.args")>
<cfset copy = ARGUMENTS.args />
<cfelse>
<cfset copy = ARGUMENTS />
</cfif>
Then later specifically set results["value"] because if you do
results.value, on flex side value is VALUE.
<cfif qry.recordCount GTE 1>
<cfset results["query"]=qry['office']>
<cfset results["message"]="Offices found.">
<cfset results["status"]=true>
<cfelse>
<cfset results["message"]="Offices not found.">
<cfset results["status"]=false>
</cfif>
Then before the return,
<cfset results["status"] = javacast("boolean",results["status"]) />
This may or may not be what you are dealing with. But I saw similar things
when I was dealing with Flex to CF and back on other websites and it helped
me get the communication going.
Also I highly recommend a bit of software like
ServiceCapture by Kevin Langdon (though I don't think he's supporting it
anymore, since he hasn't responded to forum posts in a while). But it
captures the data passed between the browser and the server, so you can
examine the exact argument names and values that are communicated vs what
you think is being communicated and can only guess at. I believe FireBug
does that with FireFox, but I haven't figured out how and I have
ServiceCapture.
--
Chuck Savage
http://SeaRisen.com
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en