Sending variables to PHP

  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

howdy folks.

i have a flash file, one the first frame it has a bunch of text boxes, and a submit button.

the submit button has this code

Code: [ Select ]
on (release) {
    backFrame = "register";

    if (name == "" || password == "" || password2 == "" || email == "" || team == "") {
        status = "Please Fill In All Fields";
    } else {
        if (password != password2) {
            status = "Passwords to not match";
        } else {
            gotoAndPlay("checking");
        }
    }
        
}
  1. on (release) {
  2.     backFrame = "register";
  3.     if (name == "" || password == "" || password2 == "" || email == "" || team == "") {
  4.         status = "Please Fill In All Fields";
  5.     } else {
  6.         if (password != password2) {
  7.             status = "Passwords to not match";
  8.         } else {
  9.             gotoAndPlay("checking");
  10.         }
  11.     }
  12.         
  13. }


(it also checks for unfilled text boxes)

on the next frame, i have a "checking" frame
on one of the frames i have this code

Code: [ Select ]
loadVariables("register.php", this, "POST");    
    if (result == "Okay") {
        gotoAndPlay("finished");
    }
  1. loadVariables("register.php", this, "POST");    
  2.     if (result == "Okay") {
  3.         gotoAndPlay("finished");
  4.     }


to send all the variables to a php script called register

i
on this frame i also have a dynamic text box, with the variable name "errorMsg"

on my php script, whenever there is an error i have this print
PHP Code: [ Select ]
" print "&errorMsg=Username Already In Use";


like if there is a duplicate item in the database.

but, for some reason my flash form gets to the checking part and stops.
I dont get an error message, it just freezes.

any idea?, something wrong with my AS, i sux at AS btw lol, i am using a new book of mine to help me along, but i kinda stumped.
  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

I have had some problems with AS and loading variables.

I long time ago, I wanted to load simple variables from a file.
ON the next line, I wanted to print the values of the variables.

I had to run a looping script for all the variables to load into the flash file before I could show their values.

I think I did this by giving flash a 10 frame head start before displaying the variables.

You could also use a while script, or onLoad script of some sort.
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

...
its not displaying variables....but sending them.

hmm, i will have to ponder further lol
  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

Have you solved this issue??
  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

Ok, I don't think you solved your original problem. You are new to actionscript so I am going to assume that you have programming experience.

I believe the problem with your script is that flash runs at a frame rate. Each frame plays and will execute any scripts that are on a key frame.

When you are sending or retrieving variables, the server may lag, or have a delay of up to 5 seconds. In flash this 5 second delay would be between 60 and 125 frames. So, if you are executing a script to run that is dependent upon variables loading from the server, you must have a loop that constantly checks to see if the variables are loaded. The next frame will send you back to the frame to check for the variables.
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

thanks for the reply.
the script that i have set to run has a 'checking' frame, so it stops, and waits for the php script to post 'Okay' to flash, then the movie continues.
so i dont think there can be any lag that way, because the movie will wait for it...

I: am going to re-make the registration form, I may even put it online for download so people can take a look at it if it dont work lol
  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

Thats a great idea. I'll be watching this topic until you get it resolved. When you finally finish it, let us all know!

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.