Why not just pass the source attribute of the ArrayCollection?  That's
the actual data itself.  Then you don't have to worry about what
datatype you're dealing with.
 
Jeff

        -----Original Message-----
        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of David Henry
        Sent: Tuesday, March 25, 2008 2:49 PM
        To: [email protected]
        Subject: [flexcoders] Re: How to pass Flex ArrayCollection to
Coldfusion CFC?
        
        
        If I remember correctly Coldfusion reads array collections  as
an Array of arrays (2d array).  CFDump should enlighten us a bit.
        
        Try this as your cfc code and read the returned string as
html/javascript.
        
        <cfcomponent displayname="TestProcess" output="false" >
            <cffunction name="sendData" access="remote" output="false"
returntype="String">
                <cfargument name="personQ" type="Any" required="true" />
                <cfset var mydump=""/><!--- Read up on var-scoping your
cffunction variables--->
                <cfsavecontent name="mydump">
                    <cfdump var="#arguments.personQ#"/>
                </cfsavecontent>
                <cfreturn mydump />
            </cffunction>
        </cfcomponent>
        
        
          David Henry 
        http://ColdFusionPowered.com/
        



        markflex2007 wrote: 

                Hi,
                
                I try to pass flex ArrayCollection to coldfusion cfc
like following
                
                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
                layout="vertical">
                <mx:Script>
                <![CDATA[
                import mx.controls.Alert;
                
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
                import mx.rpc.events.FaultEvent;
                import mx.events.ValidationResultEvent;
                
                [Bindable]
                private var myAC:ArrayCollection = new ArrayCollection([
                {id:89, Contact: 'Bob Jones' },
                {id:5, Contact: 'Jane Smith' }, 
                {id:7, Contact: 'Doug Johnson' }, 
                {id:15, Contact: 'John Jackson'} 
                ]);
                
                public function send():void { 
                cfdata.sendData(myAC);
                }
                
                
                public function send_Result(event:ResultEvent):void {
                Alert.show('ok'); 
                }
                
                public function send_Fault(event:FaultEvent):void {
                Alert.show(event.fault.message);
                } 
                
                
                
                ]]>
                </mx:Script>
                
                <mx:RemoteObject 
                id="cfdata" showBusyCursor="true" 
                destination="ColdFusion"
                source="debug.cfc.test">
                <mx:method name="send" 
                result="send_Result(event)"
                fault="send_Fault(event)" />
                </mx:RemoteObject>
                
                <mx:DataGrid id="myGrid" 
                dataProvider="{myAC}" editable="true" > 
                <mx:columns>
                <mx:DataGridColumn dataField="id" width="150"
                editable="false"/>
                <mx:DataGridColumn dataField="Contact" width="150" /> 
                
                </mx:columns> 
                </mx:DataGrid> 
                <mx:Button label="Update DB" click="send()"/>
                
                </mx:Application>
                
                This is the cfc:
                
                <cfcomponent displayname="TestProcess" output="false" >
                
                <cffunction name="sendData" access="remote"
output="false"
                returntype="true">
                <cfargument name="personQ" type="query" required="true"
/> 
                
                <cfset process = true>
                <cfreturn process />
                </cffunction> 
                </cfcomponent>
                
                I get following error message
                
                The argument pass to function is not the type query.
                
                Please let me know which data type I can use in cfc for
the Flex
                ArrayCollection
                
                Thanks
                
                Mark
                
                


<<dave-avatar.JPG>>

Reply via email to