all groups > flash actionscript > july 2007 >
You're in the

flash actionscript

group:

Flash and PHP actionscript


Re: Flash and PHP actionscript Fred
7/21/2007 8:23:32 PM
flash actionscript: [quoted text, click to view]

you could set up a varible in your php script that returns true if the
user is registered, and then check in flash to see if this varible is
true and then advance the movie to whatever frame you like if not true
go to failed frame.
Flash and PHP actionscript 3tBSI
7/21/2007 11:37:34 PM
I have a login form (i have a mysql database and everything set up) and the
login button simply has the AS:

on (release) {
loadVariablesNum("login.php", 0, "POST");
}

but i don't know what else to add to make it so if you're a registered user
(which i already have a form of) then it will go to the next frame, and if not
registered, it keeps unregistered users out.

please help, thanks
Re: Flash and PHP actionscript sneakyimp
7/22/2007 12:00:00 AM
first off, i wouldn't put any code directly on a button. it might seem easy to
you now, but in the future you will probably find yourself wondering where the
code is. it's much better to have all your code in a single frame on the main
timeline.

second, don't use loadVariablesNum(). Try using LoadVars.sendAndLoad()
instead. Assuming you have given your login button an instance name of
'loginButton', it might look something like this:

var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
for (varName in result_lv) {
trace(varName + '=' + result_lv[varName]);
}
} else {
trace("Error connecting to server.");
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.username = 'myUsername';
send_lv.password = 'myPassword';
send_lv.sendAndLoad("https://yourdomain.com/login.php", result_lv, "POST");
};
loginButton.addEventListener("click", submitListener);
AddThis Social Bookmark Button