Is it possible to pass a structure to ColdFusion using Flash AS3 / Remoting

Social Share Toolbar

UPDATE: This problem has been solved. The solution is after the post.

I’ve posted on a few forums now with no results so I’m resorting to my own blog. What I’m trying to do is pass a structure to a ColdFusion component from Flash. I’ve tried using Array, Object, and Dictionary types but it keeps failing with this error:

“Unknown object type tag (17)”

The error seems to be returned before the method is even reached suggesting that the cfc is rejecting the Remoting request altogether. I know the code is sound because I can change the structure to a string and get results back. I’ve also tried the Flash.Params method.

I’ve done a fair amount of research already, including studying Adobe livedocs which insists that it’s possible to do.

Here is my code:


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);
/* I've tried everything here including defining it as an Object and Dictionary. I also tried
defining it using dot notation and sending it as an object like so: {mystring:"hello"} */
	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’):



	
	
	

Thanks in advance for any help!

rG

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. It has to do with the way objects are serialized using AMF.

How to Setup AS2 Remoting With Flash CS3

Social Share Toolbar

Boy, was this a bitch! I can’t take credit for this solution because I found it in a reply to a Adobe forum post (thank you jedders). I just wanted to re-produce it here a) As just another place to find it, b) So I know where the solution is when I’m looking for it again, and c) Because jedders’s post missed a couple of files and I wanted a complete reference.

Why Adobe left the AS2 Remoting files out of the CS3 installation is beyond me. I work with a countless number of files that utilize AS2 remoting. I don’t have the time to convert them all to AS3 and I think it’s silly to keep Flash 8 on my machine simply because I have to compile files that utilize remoting.

Continue reading “How to Setup AS2 Remoting With Flash CS3”