Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert Remoting from AS 2 to AS 3?

2 views
Skip to first unread message

johnbarrett

unread,
Sep 22, 2008, 1:34:01 AM9/22/08
to
I am trying to convert a flash remoting application from actionscript 2(flash
8) to actionscript 3(flash CS 3), and I am stuck. While I think that I connect,
I am stuck, and hope somebody can help.

Flash 8(actionscript 2.0)
import mx.remoting.Service;
import mx.services.Log;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.DataGlue;

// Connect to the Gateway
// Establish the Service
var myService: Service = new Service(
"http://localhost/flashservices/gateway", new Log (Log.DEBUG), "cfcs.getTest",
null, null);
//path to the cfc localhost/cfcs/GetTest.cfc
//change the location of rhte cfc in the service "cfcs.getTest" to reflect the
location of the cfc

//Test the Connection
function getTestConn(){
//Create a PendingCall object
var getTestConn_pc:PendingCall = myService.getTestConn();
//Use the responder property to handle the success for failure

testConn_pc.responder = new RelayResponder(this,
"getTestConn_Result","getTestConn_Fault");
}
//Handle the Success
function getTestConn_Result(re:ResultEvent){
trace(re.result);
}
//Handle the Failure
function getTestConn_Fault(fault:FaultEvent):Void{
trace("error");
}
// Start Application
getTestConn();

ColdFusoin CFC
<cfcomponent displayName="getTest">
<!-- Establish a Flash Remoting Connection -->
<cffunction name="getTestConn" access="remote" returnType="string"
output="true">
<cfreturn "....connection successful">
</cffunction>
</cfcomponent>

Trace panel

9/18 20:20:38 [INFO] : Creating Service for cfcs.getTest
9/18 20:20:38 [INFO] : Creating gateway connection for
http://localhost/flashservices/gateway
9/18 20:20:38 [INFO] : Successfully created Service
9/18 20:20:38 [INFO] : Invoking getTestConn on cfcs.getTest
9/18 20:20:44 [INFO] : cfcs.getTest.getTestConn() returned "....connection
successful"

Now using Flash CS 3 with actionscript 3 (using the same CFC)

import flash.net.*;

var myservice:NetConnection = new NetConnection();
myservice.connect("http://localhost/flashservices/gateway");

var responder:Responder = new Responder(onResult, onFault);

function onResult(responder:Object):void{
trace(responder);
}

function onFault(responder:Object):void{
trace(responder);

}

myservice.call("cfcs.getTest", responder);
[hr]

Taiff1

unread,
Mar 31, 2009, 6:45:15 AM3/31/09
to
John, did u find the solution? can u help me pls. thnk.

johnbarrett

unread,
Mar 31, 2009, 9:03:11 PM3/31/09
to
Yes, i was able to connect`-`
I wrote a blog post about it:
http://blog.meleana.info/?p=182
0 new messages