Welcome, Guest
  • Author Topic: loadVariables to LoadVars  (Read 1134 times)

    jiffyloop

    • Server what's that
    • *
    • Posts: 22
    • Flash-db Rules
      • View Profile
      • Email
    loadVariables to LoadVars
    « on: 07/08/02, 19:10 »
    I have some source code that was originally created in Flash 5. I'm trying to rewrite the code in Flash MX using the new LoadVars Object. I'm just having a little difficulty trying to rewrite the syntax. The project I'm working on is an email form with a few fields and a submit button. After entering the form, the submit buttons sends this to a PHP file which then sends out the email. This is what I have so far:

    Frame 1:
    fscommand ("allowscale", "false");
    mailform = "mailform.php";
    action = "";
    stop ();

    Frame2:
    loadVariablesNum(mailform, 0);
    answer = "please wait for confirmation ...";
    stop();

    Button:
    on (release) {
       if ((vemail.indexOf("@") != -1) && (vemail.indexOf(".") != -1) && (length(vemail)>5)) {
          action = "Send";
          loadVariablesNum("mailform.php", 0, "POST");
          nextFrame();
       } else {
          vemail = "Please enter email";
          action = "";
          stop();
       }
    }

    So basically my question is, how do I rewrite the loadVariables to use the new LoadVars?? I get confused with the new methods of send, sendAndLoad and load....

    Any help would be appreciated.

    jiffy loop

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:loadVariables to LoadVars
    « Reply #1 on: 07/09/02, 14:58 »
    Looking your code, I think there is no reason for use the Object LoadVars. Moreover, you can use getURL instead of loadVariablesNum, because the script only sends a mail, it doesn´t return anything that you need to use.

    The object LoadVars has very useful events and methods (like the XML Object)

    - To construct a LoadVars:

    carga=new LoadVars();

    - to load something

    carga.load("http://www.estudiobaires.com/archivo.txt");

    - to use an useful event

    carga.onLoad = function(){
            gotoAndPlay(3);
    }

    - You can send and recieve requests. In the mail form with a PHP who returns some message in  a variable $string like "Thanks for contact" (succes) or "Whe have a problem with the server" (fails), you can catch the variable and show in a clip with a dynamic text

    carga.sendAndLoad("mail.php", "response", "POST");

    And use the event onLoad to catch the response an show it and so on ...

    -Other methods: getBytesTotal (useful for preloading), toString and others



    Good Luck
    Jorge Solis
    www.estudiobaires.com