Hi Hank,
I'm afraid I'll have to dissapoint you a little.
What I was doing is using the NetConnection class to invoke a "query" on a
ColdFusion component.
This is done through a (half) undocumented feature by adding a header to the
remote call:
NetConnection.addHeader("DescribeService", false, 0);
By adding this header, it allows one to retrieve a description of a ColdFusion
component (.cfc).
Up to now, I haven't figured out how to make a *real* call to a method inside a
cfc by just using a NetConnection.
My guess is one needs to define a different header (using setHeader), but I
have no idea which one, hehe..
Anyway, here's the code I used in the sample:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*"
creationComplete="init()">
<mx:Script>
<![CDATA[
import flash.net.NetConnection;
import flash.events.trace;
private function onQueryResult (result:Object) {
result_txt.text = "Responder ::: onQueryResult\n"
for (var prop:String in result) {
result_txt.text += prop+": "+result[prop]+"\n";
}
result_txt.text +=
("------------------------------------------------------\n");
// result.functions is array of objects, describing each Method in
service
for (var i:uint = 0; i<result.functions.length; i++) {
result_txt.text +=(result.functions[i]);
for (var prop:String in result.functions[i]) {
result_txt.text +=(prop+":
"+result.functions[i][prop]+"\n");
}
result_txt.text
+=("---------------------------------------------------\n");
}
}
private function onQueryStatus(){
}
private function init(){
var gatewayUrl:String =
"http://www.muzakdeezign.com/flashservices/gateway";
var gateway_conn:NetConnection = new NetConnection();
gateway_conn.objectEncoding = flash.net.ObjectEncoding.AMF0
gateway_conn.connect(gatewayUrl);
gateway_conn.addHeader("DescribeService", false, 0);
gateway_conn.call("cf_components.musicians.query", new
flash.net.Responder(onQueryResult, onQueryStatus));
}
]]>
</mx:Script>
<mx:Canvas width="100%" height="100%">
<mx:Panel x="108" y="8" height="100%" width="500" title="Flash Remoting">
<mx:Canvas height="100%" width="100%">
<mx:TextArea x="0" y="-1" width="100%" height="100%" id="result_txt"/>
</mx:Canvas>
</mx:Panel>
</mx:Canvas>
</mx:Application>
So the 2 important parts here are the addHeader() and gateway_conn.call()
methods.
The services itself is "cf_components.musicians".
Then ".query" is added to get the description from the service.
I can do the same thing in Flash 8 *and* invoke a method inside the cfc.
For this I have to remove the addHeader and the call() looks like this
gateway_conn.call("cf_components.musicians.getCategories", ...)
Where getCategories is a method of the musicians.cfc.
The only weird thing is that the returned result (which is a RecordSet) only
shows up when I also import (enable) NetDebug
or when I import mx.remoting.RecordSet
So my guess is they add a header of some sort, which I haven't been able to
figure out yet.
Anyways, the above at least shows that (the old) Remoting works fine with AS3.
All we have to do now is wait for MM to provide the proper API.
kind regards,
Muzak
hmm, and I said I wasn't gonna jump through hoops...
----- Original Message -----
From: "hank williams" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, October 19, 2005 10:50 PM
Subject: Re: [Flashcoders] Need for the Flex Server
Good Work!
It would be excellent if you would post the code that shows how you
make a remoting call that is equivalent to how it used to work. I am
sure I could figure this out but you could give us all a head start.
Hank
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders