Skip to main content
Known Participant
November 11, 2006
Question

language trouble

  • November 11, 2006
  • 5 replies
  • 750 views
Hi

Was hoping someone could help me out, I am developing an application that has a swf frontend a sql server/mysql backend, and some php/xml inbetween helping move data between them. I need the application to allow video upload hence using flash media server, now as far as I can tell flash media server talks straight to flash, no probs there. How do I get data from flash media server onto my sql server?, can xml do this?, php?.....

any advice would be much appreciated!

thanks

gav
    This topic has been closed for replies.

    5 replies

    thahipAuthor
    Known Participant
    November 14, 2006
    Thanks ekameleon

    I start development very soon, this code looks like it will help!!

    thanks again

    gav
    November 14, 2006
    ekameleon - can you give us some details about Vegas, and (beyond the AS2 class support), how it improves the communication with AMFPHP as compared to the netServices class? I haven't used vegas, and I'm wondering how it might improve my apps.

    I've been using code like this:

    remotingURI = " http://site.com/flashservices/gateway.php";
    NetServices.setDefaultGatewayUrl(remotingURI);
    gatewayconn = NetServices.createGatewayConnection();
    serv = gatewayconn.getService("amfClassName", this);

    serv.methodName(vars);
    this.methodName_Result = function(data){
    // do stuff with the return data
    }
    this.methodName_Status = function(data){
    // handle the status event
    }


    Also, does Vegas consume more memory than the netServices class does, and if so, can you give us an idea of how much?

    Thanks.
    Inspiring
    November 12, 2006
    gggrrr... i forget the result lol

    i resumed the full code :

    load("src/vegas.asc") ;

    //// Little connector class /////

    Connector = function( gatewayURL /*String*/ , serviceName /*String*/,
    methodName /*String*/ , args /*Array*/ )
    {

    // Classes References to simplify the code.

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

    var Delegate = vegas.events.Delegate ;

    // Create the RemotingService instance.

    this.service = new RemotingService() ;


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

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

    this.service.gatewayUrl = gatewayURL ;
    this.service.serviceName = serviceName ;
    this.service.methodName = methodName ;
    this.service.params = args ; // The arguments of the method.
    }
    /**
    * Launch the service
    */
    Connector.prototype.run = function()
    {
    this.service.trigger() ;
    }

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

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

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

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

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

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



    //// TEST /////


    var connect = new Connector(" http://localhost/php/gateway.php",
    "MyService", "MyMethod", [ "hello world" ] )

    connect.run() ; // launch the service.


    sorry :)

    EKA+ :)



    ekameleon a écrit :
    > ooops :) I forget a line in my example, at the end :
    >
    >
    > > //// TEST /////
    > >
    > >
    > > var connect = new Connector(" http://localhost/php/gateway.php",
    > > "MyService", "MyMethod", [ "hello world" ] ) ;
    >
    > // run the service
    > connect.run() ;
    >
    >
    > EKA+ :)
    >
    >
    > ekameleon a écrit :
    >> Hello :)
    >>
    >> you can use AMF protocol with AMFPHP for example : http://amfphp.org/
    >>
    >> To use AMFPHP with FMS you can use my framework VEGAS and this SSAS
    >> version (Server Side ActionScript = Javascript 1.5 for FMS)
    >>
    >> http://vegas.riaforge.org/
    >>
    >> install the framework with a SVN(subversion) client like TortoiseSVN.
    >>
    >> After you search the SSAS directory in the SVN and install in your
    >> application my package :
    >>
    >> http://svn.riaforge.org/vegas/SSAS/trunk/src/
    >>
    >> to use VEGAS in SSAS you must in your main.asc write :
    >>
    >> load("src/vegas.asc") ;
    >>
    >> //// Little connector class /////
    >>
    >> Connector = function( gatewayURL /*String*/ , serviceName /*String*/,
    >> methodName /*String*/ , args /*Array*/ )
    >> {
    >>
    >> // Classes References to simplify the code.
    >>
    >> var ActionEvent = asgard.events.ActionEvent ;
    >> var RemotingAuthentification =
    >> asgard.net.remoting.RemotingAuthentification ;
    >> var RemotingEvent = asgard.events.RemotingEvent ;
    >> var RemotingService = asgard.net.remoting.RemotingService ;
    >>
    >> var Delegate = vegas.events.Delegate ;
    >>
    >> // Create the RemotingService instance.
    >> this.service = new RemotingService() ;
    >>
    >> // Use AMF credentials with role //
    >> service.setCredentials( new RemotingAuthentification( LOGIN , PASS ) ) ;
    >>
    >> this.service.addEventListener( RemotingEvent.ERROR, new
    >> Delegate(this, this._onError) ) ;
    >> this.service.addEventListener( RemotingEvent.FAULT, new
    >> Delegate(this, this._onFault) ) ;
    >> this.service.addEventListener( ActionEvent.FINISH, new
    >> Delegate(this, this._onFinish) ) ;
    >> this.service.addEventListener( RemotingEvent.RESULT, new
    >> Delegate(this, this.onResult) ) ;
    >> this.service.addEventListener( ActionEvent.START, new
    >> Delegate(this, this._onStart) ) ;
    >> this.service.addEventListener( RemotingEvent.TIMEOUT, new
    >> Delegate(this, this._onTimeOut) ) ;
    >> this.service.gatewayUrl = gatewayURL ;
    >> this.service.serviceName = serviceName ;
    >> this.service.methodName = methodName ;
    >> this.service.params = args ; // The arguments of the method.
    >> }
    >> /**
    >> * Launch the service
    >> */
    >> Connector.prototype.run = function()
    >> {
    >> this.service.trigger() ;
    >> }
    >>
    >> Connector.prototype._onError = function ( e /*RemotingEvent*/ )
    >> {
    >> trace("> " + this + " : " + e.type + " : " + e.code) ;
    >> }
    >>
    >> Connector.prototype._onFault = function( e /*RemotingEvent*/ )
    >> {
    >> trace("> " + this + " : " + e.type + " : " + e.getCode() + " :: " +
    >> e.getDescription()) ;
    >> }
    >>
    >> Connector.prototype._onFinish = function( e /*ActionEvent*/ )
    >> {
    >> trace("> " + this + " : " + e.type) ;
    >> }
    >>
    >> Connector.prototype._onStart = function( e /*ActionEvent*/ )
    >> {
    >> trace("> " + this + " : " + e.type ) ;
    >> }
    >>
    >> Connector.prototype._onTimeOut = function( e /*RemotingEvent*/ )
    >> {
    >> trace("> " + this + " : " + e.type ) ;
    >> }
    >>
    >>
    >>
    >> //// TEST /////
    >>
    >>
    >> var connect = new Connector(" http://localhost/php/gateway.php",
    >> "MyService", "MyMethod", [ "hello world" ] ) ;
    >>
    >>
    >> PS : you AMFPHP service must be a little method who return a string
    >> for example :)
    >>
    >>
    >> EKA+ :)
    >>
    >>
    >> thahip a écrit :
    >>> Hi
    >>>
    >>> Was hoping someone could help me out, I am developing an application
    >>> that has a swf frontend a sql server/mysql backend, and some php/xml
    >>> inbetween helping move data between them. I need the application to
    >>> allow video upload hence using flash media server, now as far as I
    >>> can tell flash media server talks straight to flash, no probs there.
    >>> How do I get data from flash media server onto my sql server?, can
    >>> xml do this?, php?.....
    >>>
    >>> any advice would be much appreciated!
    >>>
    >>> thanks
    >>>
    >>> gav
    >>>
    Inspiring
    November 12, 2006
    ooops :) I forget a line in my example, at the end :


    > //// TEST /////
    >
    >
    > var connect = new Connector(" http://localhost/php/gateway.php",
    > "MyService", "MyMethod", [ "hello world" ] ) ;

    // run the service
    connect.run() ;


    EKA+ :)


    ekameleon a écrit :
    > Hello :)
    >
    > you can use AMF protocol with AMFPHP for example : http://amfphp.org/
    >
    > To use AMFPHP with FMS you can use my framework VEGAS and this SSAS
    > version (Server Side ActionScript = Javascript 1.5 for FMS)
    >
    > http://vegas.riaforge.org/
    >
    > install the framework with a SVN(subversion) client like TortoiseSVN.
    >
    > After you search the SSAS directory in the SVN and install in your
    > application my package :
    >
    > http://svn.riaforge.org/vegas/SSAS/trunk/src/
    >
    > to use VEGAS in SSAS you must in your main.asc write :
    >
    > load("src/vegas.asc") ;
    >
    > //// Little connector class /////
    >
    > Connector = function( gatewayURL /*String*/ , serviceName /*String*/,
    > methodName /*String*/ , args /*Array*/ )
    > {
    >
    > // Classes References to simplify the code.
    >
    > var ActionEvent = asgard.events.ActionEvent ;
    > var RemotingAuthentification =
    > asgard.net.remoting.RemotingAuthentification ;
    > var RemotingEvent = asgard.events.RemotingEvent ;
    > var RemotingService = asgard.net.remoting.RemotingService ;
    >
    > var Delegate = vegas.events.Delegate ;
    >
    > // Create the RemotingService instance.
    >
    > this.service = new RemotingService() ;
    >
    >
    > // Use AMF credentials with role
    > // service.setCredentials( new RemotingAuthentification( LOGIN ,
    > PASS ) ) ;
    >
    > this.service.addEventListener( RemotingEvent.ERROR, new
    > Delegate(this, this._onError) ) ;
    > this.service.addEventListener( RemotingEvent.FAULT, new
    > Delegate(this, this._onFault) ) ;
    > this.service.addEventListener( ActionEvent.FINISH, new
    > Delegate(this, this._onFinish) ) ;
    > this.service.addEventListener( RemotingEvent.RESULT, new
    > Delegate(this, this.onResult) ) ;
    > this.service.addEventListener( ActionEvent.START, new Delegate(this,
    > this._onStart) ) ;
    > this.service.addEventListener( RemotingEvent.TIMEOUT, new
    > Delegate(this, this._onTimeOut) ) ;
    >
    > this.service.gatewayUrl = gatewayURL ;
    > this.service.serviceName = serviceName ;
    > this.service.methodName = methodName ;
    > this.service.params = args ; // The arguments of the method.
    > }
    > /**
    > * Launch the service
    > */
    > Connector.prototype.run = function()
    > {
    > this.service.trigger() ;
    > }
    >
    > Connector.prototype._onError = function ( e /*RemotingEvent*/ )
    > {
    > trace("> " + this + " : " + e.type + " : " + e.code) ;
    > }
    >
    > Connector.prototype._onFault = function( e /*RemotingEvent*/ )
    > {
    > trace("> " + this + " : " + e.type + " : " + e.getCode() + " :: " +
    > e.getDescription()) ;
    > }
    >
    > Connector.prototype._onFinish = function( e /*ActionEvent*/ )
    > {
    > trace("> " + this + " : " + e.type) ;
    > }
    >
    > Connector.prototype._onStart = function( e /*ActionEvent*/ )
    > {
    > trace("> " + this + " : " + e.type ) ;
    > }
    >
    > Connector.prototype._onTimeOut = function( e /*RemotingEvent*/ )
    > {
    > trace("> " + this + " : " + e.type ) ;
    > }
    >
    >
    >
    > //// TEST /////
    >
    >
    > var connect = new Connector(" http://localhost/php/gateway.php",
    > "MyService", "MyMethod", [ "hello world" ] ) ;
    >
    >
    > PS : you AMFPHP service must be a little method who return a string for
    > example :)
    >
    >
    > EKA+ :)
    >
    >
    > thahip a écrit :
    >> Hi
    >>
    >> Was hoping someone could help me out, I am developing an application
    >> that has a swf frontend a sql server/mysql backend, and some php/xml
    >> inbetween helping move data between them. I need the application to
    >> allow video upload hence using flash media server, now as far as I can
    >> tell flash media server talks straight to flash, no probs there. How
    >> do I get data from flash media server onto my sql server?, can xml do
    >> this?, php?.....
    >>
    >> any advice would be much appreciated!
    >>
    >> thanks
    >>
    >> gav
    >>
    Inspiring
    November 12, 2006
    Hello :)

    you can use AMF protocol with AMFPHP for example : http://amfphp.org/

    To use AMFPHP with FMS you can use my framework VEGAS and this SSAS
    version (Server Side ActionScript = Javascript 1.5 for FMS)

    http://vegas.riaforge.org/

    install the framework with a SVN(subversion) client like TortoiseSVN.

    After you search the SSAS directory in the SVN and install in your
    application my package :

    http://svn.riaforge.org/vegas/SSAS/trunk/src/

    to use VEGAS in SSAS you must in your main.asc write :

    load("src/vegas.asc") ;

    //// Little connector class /////

    Connector = function( gatewayURL /*String*/ , serviceName /*String*/,
    methodName /*String*/ , args /*Array*/ )
    {

    // Classes References to simplify the code.

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

    var Delegate = vegas.events.Delegate ;

    // Create the RemotingService instance.

    this.service = new RemotingService() ;


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

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

    this.service.gatewayUrl = gatewayURL ;
    this.service.serviceName = serviceName ;
    this.service.methodName = methodName ;
    this.service.params = args ; // The arguments of the method.
    }
    /**
    * Launch the service
    */
    Connector.prototype.run = function()
    {
    this.service.trigger() ;
    }

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

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

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

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

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



    //// TEST /////


    var connect = new Connector(" http://localhost/php/gateway.php",
    "MyService", "MyMethod", [ "hello world" ] ) ;


    PS : you AMFPHP service must be a little method who return a string for
    example :)


    EKA+ :)


    thahip a écrit :
    > Hi
    >
    > Was hoping someone could help me out, I am developing an application that has
    > a swf frontend a sql server/mysql backend, and some php/xml inbetween helping
    > move data between them. I need the application to allow video upload hence
    > using flash media server, now as far as I can tell flash media server talks
    > straight to flash, no probs there. How do I get data from flash media server
    > onto my sql server?, can xml do this?, php?.....
    >
    > any advice would be much appreciated!
    >
    > thanks
    >
    > gav
    >
    November 11, 2006
    I would suggest using AMFPHP and the FMS netservices class. AMFPHP works just like remoting, but it's built for PHP (and it's free... which doesn't hurt). There are some basic AMFPHP tutorials at flash-db.com

    Alternately, you can use the loadVars or XML classes on FMS just like you do with client side actionscript.

    I prefer to use AMFPHP mainly because it reduces load on the FMS application, and burns less data transfer than using XML or loadVars. AMFPHP will accept the data as actionscript objects, so the FMS app doesn't have to waste time building up XML or variable strings to pass the data.
    thahipAuthor
    Known Participant
    November 14, 2006
    Thanks Jay,

    That has helped a lot!!

    Your input is much appreciated

    Gav