I'm trying to pass a structure to a ColdFusion component from Flash but it
keeps failing with this error:
"Unknown object type tag (17)"
Here's my AS. I've tried using Array, Object, and Dictionary as types:
-------------------------------------------------------------------------------
loadData_btn.addEventListener(MouseEvent.MOUSE_DOWN, loadData)
var myService = new NetConnection()
myService.connect("http://localhost/flashservices/gateway/")
function loadData(evt:MouseEvent){
var responder = new Responder(getTest_Result, onFault);
var mystruct:Array = new Array();
mystruct["mystring"] = "hello";
myService.call("com.mycomponent.test", responder, mystruct);
}
function getTest_Result(result){
trace("success: "+ result);
}
function onFault( f){
trace("There was a problem: " + f.description);
}
-------------------------------------------------------------------------------
...and here's my component function (I've tried with an argument type of
'struct' as well as 'any':
-------------------------------------------------------------------------------
<cffunction name="test" output="no" access="remote" returntype="string" >
<cfargument name="argstruct" type="any" required="yes" />
<cfset mystr =arguments.argstruct["mystring"]>
<cfreturn mystr />
</cffunction>
-------------------------------------------------------------------------------
I was successful in sending and returning a string as a test to ensure that
the apps were set up correctly. It's only when I try to pass a struct that I
get an error.
I've seen the docs on using the Flash scope in CF but I get the same error
when I try it.
Thanks in advance for any help,
Glenn
RabidGadfly - 20 May 2008 20:09 GMT
Found my own solution.
After many hours of Googling, and much trial and error, I figured out how to
make this work?and it?s a one line solution. Simply add
myService.objectEncoding=0 before the myService.connect line at the top of the
AS code. It controls the way objects are serialized using AMF.
SamNUK - 14 Jul 2008 15:36 GMT
Dude...
How would I go about fixing the same error with an <mx:RemoteObject>
tag?