Hello and thank you in advance for reading. I've been trying to make login accounts for my flash website, but I've had much trouble finding a tutorial on how to do it in AS3. In other words, I have no clue how to use AS2, so I'm hoping someone can translate the following code to work in AS3. I found this tutorial on the FlashKit website, but not in the format I need it. Here's a link to the orininal tutorial. http://www.tutcity.com/view/ultra-si...gin.11602.html Now what I need in my login is the ability for new users to create their own accounts, and then for them to be able to log back into them of course. Here's the specific part of the tutorial I need help converting.

"1.) Two input text boxes, one for the user to input a username and the other a password. They both need variable names of "username" and "pass". Note In my swf at the start of this tutorial I have 3 fields, an extra one to confirm the password. Adding this is entirely up to you.

2.) Two buttons, one for registering new username and password combinations and another for logging in after registration is successful. The login button needs at least this code

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

The register button needs at least this code

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

But there is other code as well that is not mandatory but quite important. Firstly you must limit the possible characters inputted. This code on the main timeline will deal with that.

usernew.restrict = "a-zA-Z0-9";

This restricts the character entry to the instance of usernew (don't forget to give your username input textbox an instance name (usernew) as well as variable name) to letters of the alphabet (lower and uppercase) and the 10 digits. Do this for the password input textbox also and give it an instance name.

Maximum number of characters can be controlled using the textbox properties but making sure the user enters in a minimum number of characters can be coded for on the register button using an "if" statement.

if(username.length>= 6 && pass.length>= 6){
loadVariablesNum("register.php", 0, "POST");
}else{
_root.words = "Username must have between 6 and 12 characters.";
}

assuming you have set the maximum number of characters to 12.

Also it pays to check that something has actually been entered in the textboxes during login. On the main timeline set

username="";
pass="";

Then on the login button put

if (username != "" && pass != "") {
loadVariablesNum("login.php", 0, "POST");
}else{
_root.words = "Please enter a username and password";
}

If you want to look extra smart in the login and register buttons under the loadVariables command add

words="Processing..."

or something similar. You will need to add a dynamic textbox with the variable name, "words" to display all the feedback, both from the flash buttons as well as the php file. Finally check out the full working version at My Website and if you want to contact me use the flash form there also. "


If you're looking for the PHP files they're refering to, they're on the second page of the tutorial. (The quoted bit from above comes from the 3rd). Hope this isn't too confusing. And again, thank you in advance