Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2007, 11:22
rafa28
 
Fecha de Ingreso: julio-2002
Mensajes: 195
Antigüedad: 21 años, 8 meses
Puntos: 0
pasar de flash mx a 8

Estoy construyendo un sistema de login con asp y flash a partir de un tutorial que he encontrado en http://www.flashmagazine.com/695.htm, pero está hecho para flash mx y yo estoy usando flash 8, y creo que por eso no funciona bien.
El flash 8 no me da ningún error, pero el sistema no funciona. Creo que uno de los problemas es que tengo que crear una instancia del botón del panel de componentes, y ponerle como parámetro Click Handler con valor "onLogin". No soy capaz de hacerlo. Como se puede hacer eso?
Me podeis decir si esto está bien para flash 8:

// first we create the object
login_lv = new LoadVars();

//now we create the function that will happen when this object receives data
login_lv.onLoad=function(){

//check to see if the users info is correct
if(this.userInfo == "true"){
trace("Welcome");
}else{
//if the users info was not correct, trace an error, and clean the text fields
trace("Invalid data");
login_txt.text="";
password_txt.text="";
}
}

Now we have that set, lets create the function that will happen when the user tries to login, and we will add some client side validation to make sure the user actually did put information in both text fields, and the password is at least a certain length.

//the function for the login button
onLogin=function(){
//an error will occur if the user didn't enter a login name
if(login_txt.text.length<1){
trace("please provide a login name");
//an error will occur if the password is not the right length
}else if(password_txt.text.length<5){
trace("invalid password");
//and clean out the password
password_txt.text="";
}else{
//this is if everything is fine to send

//we will store the user information as properties of the LoadVars object
login_lv.username=login_txt.text;
login_lv.password=password_txt.text;
//now we send the data, and wait to recieve something back
login_lv.sendAndLoad("login.asp", login_lv, "POST");
}
}
__________________
EL conocimiento es la base del poder