Welcome, Guest
  • Author Topic: A problem from the "Remoting" section  (Read 2578 times)

    kingleo

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    A problem from the "Remoting" section
    « on: 11/07/04, 10:41 »
    #include "NetServices.as"
    #include "NetDebug.as"
    ///////////////////////////////////////////
    //Requests Handlers
    ///////////////////////////////////////////
    getFile_Result = function(texto){
       if(texto=="Error") {
           status.text = "Error opening the file"
           mainText.text = ""
       } else {
           status.text = "File loaded"
           mainText.text = texto
       }
    }
    saveFile_Result = function(message){
       mainText.backgroundColor = 0xFFFFFF
       status.text = message
    }
    //////////////////////////////////////////
    // Connection to service
    //////////////////////////////////////////
    var conn = NetServices.createGatewayConnection("Path to your gateway.php");

    // Specify the service you want to use.  There has to be a file called 'formToText.php'  
    // in your services directory.
    var myService = conn.getService("formToText", this);

    //////////////////////////////////////
    //Components handlers
    ///////////////////////////////////////
    function loadFile(comp){
       //loads selected file
       var file = comp.getSelectedItem().data
       myService.getFile(file, this)
    }
    function save(comp){
       //saves text to selected file
       var file = list.getSelectedItem().data
       mainText.backgroundColor = 0xCCCCCC
       myService.saveFile(file, mainText.text, this)
    }
    stop()
    -----------------------------------------------------------------------------------------------------------------------
    this is the editing system of text files....but i don't really understand several things:

    1. #include "NetServices.as"
       #include "NetDebug.as"
    what are these things for?

    2.var myService = conn.getService("formToText", this);
    "formToText" here is the name of folder or what???
    -----------------------------------------------------------------------------------------------------------------------
    plus, i tried on my localhost, and it doesn't work... I don't know, nothing shows in status area...

    can anyone tell me how to set it up? (cuz by the original steps, it doesn't work...)

    Donald Fletcher

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re:A problem from the "Remoting" section
    « Reply #1 on: 11/07/04, 17:28 »
    hello kingleo,
    Code: [Select]

    #include "NetServices.as"
    #include "NetDebug.as"


    ...are external actionscript classes.


    When you use flash you use actionscript to control the application. An external actionscript class is the code that is written without a timeline. You can control every aspect of flash using external actionscript classes and alot of people (myself included) prefer to keep all the computer code in files like the ones above.

    What does "NetServices.as" do? It has sections in it called methods, each method has a function to perform, and as it is a remoting class, all of the methods relate to establishing connections, sending data, recieving data, and closing connections.

    The "#include" lets you access the methods of that class. The example that you are following is kind of difficult. I would suggest something a bit easier to get you started, try the the "Hello World" in this site or

    http://www.actionscript.org/tutorials/intermediate/PHP_Remoting/index.shtml

    Best of luck, theDonkey

    kingleo

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:A problem from the "Remoting" section
    « Reply #2 on: 11/08/04, 11:04 »
    thx...dear mr. donkey...

    yeah, i'm studying the application of flash+php

    i'd like to know about this more...

    Donald Fletcher

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re:A problem from the "Remoting" section
    « Reply #3 on: 11/09/04, 14:19 »
    kingleo,

    I to am not to hot on php but I can try to answer your second question...

    2.var myService = conn.getService("formToText", this);
    "formToText" here is the name of folder or what???


    "formToText" is the name of a php class. Again the  "formToText" class has methods declared in the method table of the class which can be accessed via an RPC (Remote Procedure Call), which is what flash remoting takes care of for you. A good link into the syntax of remoting is the .pdf in...
    http://www.macromedia.com/support/documentation/en/flash_remoting/documentation.html

    This is not all that usefull for php remoting but does have the actionscript dictionary for remoting.

    theDonkey