Your custom ActionScript object is translated into a ColdFusion structure. So, make sure your object name and the argument name are identical, then make sure the argument type is struct.

 

When you pass custom objects back from the server, make sure they are arrays of structures.

 

Here is a call to the RO:

restService.addReview({review:event.eventReviewProp})

 

In the CFC:

<cffunction name="addReview" access="remote" returntype="boolean">

      <cfargument name="review" type="struct" required="yes">

      …

</cffunction>

 

Rob Rusher

 

 

 

RIA Consultant

 

Macromedia Certified Flex Instructor

 

e:[EMAIL PROTECTED] c:303.885.7044 im:robrusher

 

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Kai Pradel
Sent: Thursday, January 26, 2006 4:02 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Sending complex data types to ColdFusion form Flex 1.5

 

Hi all,

 

I have been trying to use Remote-Object to pass complex data types from

Flex to ColdFusion - to no avail. Simple arrays and strings can be

passed easily, but as soon as I send an object all hell breaks loose.

 

I am running ColdFusion 7 (updater 3) on Win2K with Flex 1.5 (all on one

machine) using Apache 2.

 

If anyone has a working example on how to pass complex data types to

ColdFusion that shows how I can read them out as argument.passedinobject

I would greatly appreciate your help.

 

Here is the situation:

I am wrapping annotationdata into a shell object which is sent to a

ColdFusion component. Using the debugger, I can see that the correctly

formatted object is sent out. However, ColdFusion responds with "unknown

error" if I try to access the passed in data.

 

I don't get an error if I don't set a datatype or required to yes.

However, I am also unable to access the passed in object.

 

Thanks,

Kai

 

 

Flex Code:

==============================================================

==============================================================

<?xml version="1.0" encoding="utf-8"?>

  <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"

creationComplete="addData();">

 

  <mx:Script>

  <![CDATA[

    var shellObject:Object = new Object();

 

    var annotationdata:Array = new Array();

 

    var dataObj:Object = new Object();

    var dataObj1:Object = new Object();

 

   function addData() {

 

       dataObj.timestamp = 123;

       dataObj.annotation = "this is a string ";

 

       dataObj1.timestamp = 456;

       dataObj1.annotation = "this is another string";

 

 

       annotationdata.push(dataObj);

       annotationdata.push(dataObj1);

 

       shellObject.myArgument = annotationdata

 

       filemanagerfunctions.myFunction(shellObject);

       }

  ]]>

  </mx:Script>

 

  <mx:RemoteObject id="filemanagerfunctions"

endpoint="http://192.168.168.1/flashservices/gateway"

fault="mx.controls.Alert.show('hello!')"

source="mediasilodev.components.helloworld"  showBusyCursor="true">

 

    <mx:method name="myFunction" result="alert(event.result)" />

 

  </mx:RemoteObject>

 

 

  </mx:Application>

 

 

 

 

ColdFusion Code:

==============================================================

==============================================================

<cfcomponent>

<cffunction name="myFunction" access="remote" returntype="string">

<cfargument name="myArgument" required="no">

      <cffile    

            action = ""

            file = "d:/Inetpub/Webroot/mediasilodev/output.html" 

            output = "#arguments.myArgument.data1#"> 

      <cfreturn "Got something">

</cffunction>

</cfcomponent>

 

 

--

Flexcoders Mailing List

FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt

Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com

Yahoo! Groups Links

 

<*> To visit your group on the web, go to:

    http://groups.yahoo.com/group/flexcoders/

 

<*> To unsubscribe from this group, send an email to:

    [EMAIL PROTECTED]

 

<*> Your use of Yahoo! Groups is subject to:

    http://docs.yahoo.com/info/terms/

 

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to