Skip to main content
Inspiring
November 12, 2006
Question

Remoting from FMS

  • November 12, 2006
  • 4 replies
  • 532 views
I've been trying to create a NetService object and use that to call and get the reply of my AMFPHP remoting gateway, but for some reason this isn't working.

I've read all the documentation I've found (not much -- apparently most want to do remoting client side, not server side), but it's not really clear how to debug the process...

Any help is greatly appreciated.

The code on the FMS main.asc file is as follows, and I've verified that the gateway does indeed work from another application (non-flash):

quote:


load("NetServices.asc");

application.onConnect = function(newClient, userKey) {
this.acceptConnection(newClient);

newClient.msgFromClient = function(msg) {
msg = '<b>'+userKey+":</b> "+msg+"<br>";
application.history += msg;
application.users_so.send("msgFromSrv", msg);
};

application.users_so.send("msgFromSrv", "rawr");
gc = NetServices.createGatewayConnection(" http://localhost/flashservices/gateway.php");
svc = gc.getService("xtt", this);
svc.deduct_point("334");
}

application.onAppStart = function() {
application.users_so = SharedObject.get("users_so", false);
};

function deduct_point_Result(key) {
application.users_so.send("msgFromSrv", "Deducted points...");
}

    This topic has been closed for replies.

    4 replies

    seraerieAuthor
    Inspiring
    November 13, 2006
    Alright then, I'll do it your way. Thanks for clearing that up :D
    Inspiring
    November 12, 2006
    The NetConnection is the native class to use AMF protocol (FMS or
    Remoting is the same protocol)

    My framework is a complete library (in AS2, AS3 & SSAS) to use remoting
    etc...

    FMS use SSAS and SSAS = javascript 1.5 + FMS native objects (Client,
    Application, ....)

    You can use the library of Macromedia (in the scriptlib directory) but
    it's a old script with lot's of problems...

    EKA+ :)

    seraerie a écrit :
    > There's no way to do remoting natively on FMS?
    seraerieAuthor
    Inspiring
    November 12, 2006
    Thanks for the answer

    But there's no way to do remoting natively on FMS?
    Inspiring
    November 12, 2006
    Hello :)

    read the message "Language trouble" in this mailing list :)

    i explain an example to use my openSource framework in SSAS to use AMFPHP

    1 - install VEGAS SSAS ( http://vegas.riaforge.org/)

    1.1 : download the SVN of vegas : http://svn.riaforge.org/vegas/

    PS : use a SVN client, This project is sharing its code via Subversion.
    Subversion is an open source source control method. You may find more
    information about about Subversion here: http://subversion.tigris.org/


    1.2 : copy the SSAS framework in your applications/yourApplication/
    directory or in the scriptlib/ directory



    2 - example in a main.asc :

    load("src/vegas.asc") ;

    // Classes References to simplify the code.

    ActionEvent = asgard.events.ActionEvent ;
    RemotingAuthentification = asgard.net.remoting.RemotingAuthentification ;
    RemotingEvent = asgard.events.RemotingEvent ;
    RemotingService = asgard.net.remoting.RemotingService ;

    Delegate = vegas.events.Delegate ;

    // Create the RemotingService instance.

    service = new RemotingService() ;

    // Use AMF credentials with role
    // service.setCredentials( new RemotingAuthentification( LOGIN , PASS ) ) ;

    service.addEventListener( RemotingEvent.ERROR, new Delegate(this,
    this._onError) ) ;
    service.addEventListener( RemotingEvent.FAULT, new Delegate(this,
    this._onFault) ) ;
    service.addEventListener( ActionEvent.FINISH, new Delegate(this,
    this._onFinish) ) ;
    service.addEventListener( RemotingEvent.RESULT, new Delegate(this,
    this.onResult) ) ;
    service.addEventListener( ActionEvent.START, new Delegate(this,
    this._onStart) ) ;
    service.addEventListener( RemotingEvent.TIMEOUT, new Delegate(this,
    this._onTimeOut) ) ;

    /**
    * Invoqued when the service success the call of the method.
    */
    this.onResult = function ( e )
    {
    var result = e.result ;
    trace("> " + this + " : " + e.type + " : " + result) ;
    }

    this._onError = function ( e /*RemotingEvent*/ )
    {
    trace("> " + this + " : " + e.type + " : " + e.code) ;
    }

    this._onFault = function( e /*RemotingEvent*/ )
    {
    trace("> " + this + " : " + e.type + " : " + e.getCode() + " :: " +
    e.getDescription()) ;
    }

    this._onFinish = function( e /*ActionEvent*/ )
    {
    trace("> " + this + " : " + e.type) ;
    }

    this._onStart = function( e /*ActionEvent*/ )
    {
    trace("> " + this + " : " + e.type ) ;
    }

    this._onTimeOut = function( e /*RemotingEvent*/ )
    {
    trace("> " + this + " : " + e.type ) ;
    }


    //// TEST /////

    service.gatewayUrl = " http://localhost/php/gateway.php" ;
    service.serviceName = "MyService" ;
    service.methodName = "MyMethod" ;
    service.params = [ "hello world" ] ; // The arguments of the method.

    /**
    * Launch the service
    */
    service.trigger() ;


    EKA+ :)


    seraerie a écrit :
    > I've been trying to create a NetService object and use that to call and get the
    > reply of my AMFPHP remoting gateway, but for some reason this isn't working.
    >
    > I've read all the documentation I've found (not much -- apparently most want
    > to do remoting client side, not server side), but it's not really clear how to
    > debug the process...
    >
    > Any help is greatly appreciated.
    >
    > The code on the FMS main.asc file is as follows, and I've verified that the
    > gateway does indeed work from another application (non-flash):
    >
    >
    quote:


    > load("NetServices.asc");
    >
    > application.onConnect = function(newClient, userKey) {
    > this.acceptConnection(newClient);
    >
    > newClient.msgFromClient = function(msg) {
    > msg = ' '+userKey+": "+msg+"<br>";
    > application.history += msg;
    > application.users_so.send("msgFromSrv", msg);
    > };
    >
    > application.users_so.send("msgFromSrv", "rawr");
    > gc =
    > NetServices.createGatewayConnection(" http://localhost/flashservices/gateway.php"
    > );
    > svc = gc.getService("xtt", this);
    > svc.deduct_point("334");
    > }
    >
    > application.onAppStart = function() {
    > application.users_so = SharedObject.get("users_so", false);
    > };
    >
    > function deduct_point_Result(key) {
    > application.users_so.send("msgFromSrv", "Deducted points...");
    > }
    >

    >