Comunidad de diseño web y desarrollo en internet online

ayudaaa cambiar de pagina

Citar            
MensajeEscrito el 04 Feb 2010 10:17 pm
Hola a todos tengo una duda cuando le doy clic en el boton entrar solo valida si la contraseña es de 3 caracteres y tiene nombre de usuario lo que necesito es:

si la validacion es correcta, me pase a otra ventana o como dirian ustedes q me pase a otro state el siguiente state se llama pag1 donde ira todo el desarrollo y se tiene que ocultar el login si alguien me pudiera ayudar se lo agradeseria ando algo atorado aqui U_U

probe con el currentState en el boton pero no valida y en automatico se pasa a la otra debe de ir en el script deje un comentario en el codigo donde deberia de ir pero que no logro encontrar

Código Flex :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="white" width="100%" height="100%">
   <mx:states>
      <mx:State name="pag1">
         <mx:AddChild position="lastChild">
            <mx:Panel x="85" y="92" width="250" height="200" layout="absolute">
            </mx:Panel>
         </mx:AddChild>
      </mx:State>
   </mx:states>
   
   <mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
import mx.controls.Alert;
private function validateUser():void
{
   var userValidation:ValidationResultEvent = validUserName.validate();
   var passwordValidation:ValidationResultEvent = validPassword.validate();
   if(userValidation.type == ValidationResultEvent.VALID && passwordValidation.type == ValidationResultEvent.VALID)
   {
   Alert.show("Tu informacion es valida");
    //aki debe de ir el codigo pero no se cual sea XD
   
   }
   else
   {
   Alert.show("Tu información no es correcta");
   }
}
]]>
</mx:Script>
<mx:Form horizontalCenter="-20" verticalCenter="-50">
<mx:FormItem label="Usuario: ">
<mx:TextInput id="myName"/>
</mx:FormItem>
<mx:FormItem label="Contraseña">
<mx:TextInput id="myPassword" displayAsPassword="true"/>
</mx:FormItem>
   <mx:FormItem width="244" height="26">
      <mx:Button click="validateUser()" label="Entrar"  cornerRadius="6" borderColor="#3A6F98" themeColor="#19306A"/>
   </mx:FormItem>
</mx:Form>

<mx:StringValidator id="validUserName" source="{myName}" property="text" triggerEvent=""/>
<mx:StringValidator id="validPassword" source="{myPassword}" property="text" triggerEvent="" minLength="3" maxLength="6" tooShortError="La contraseña debe ser mayor a 3 caracteres" tooLongError="El maximo de caracteres es de 6"/>
   
   <mx:Image x="10" y="10" width="195" height="51" autoLoad="true" scaleContent="true">
      <mx:source>imagenes/bancomer.jpg</mx:source>
   </mx:Image>
   
</mx:Application>

Por juramy

Claber

217 de clabLevel

2 tutoriales

 

Programador

msie8
Citar            
MensajeEscrito el 04 Feb 2010 11:10 pm
ayudaaa pliiissss!!!! :shock:


Código Flex :

  

     {
    Alert.show("Tu informacion es valida");     
    //aki debe de ir el codigo pero no se como escribirlo para pasar a otra pagina si es valida la informacion
    }    
    else  
    {  
    Alert.show("Tu información no es correcta");    
    } 

} 

Por juramy

Claber

217 de clabLevel

2 tutoriales

 

Programador

msie8
Citar            
MensajeEscrito el 05 Feb 2010 03:15 am
Una idea:

Al comienzo crea tu panel principal y dejalo visible false, cuando el login sea correcto le cambias el estado a visible true y tu panel de login a false.

Otra idea:

Usa modulos, entonces con en ves de usar visible false, vas a usar loadModule() y unloadModule()

Espero que te sirvan

saludos

Por acroarSka

9 de clabLevel



 

firefox
Citar            
MensajeEscrito el 05 Feb 2010 09:54 pm
ok ya aprendi a moverme por componentes y modulos solo que eso me sale por el boton o un link y necesito abrir el componente desde el script pero no se como alguien sabe como es la sintaxis!!

Código Flex :

if(userValidation.type == ValidationResultEvent.VALID && passwordValidation.type == ValidationResultEvent.VALID)
   {
   Alert.show("Tu informacion es valida");


                  //AQUI QUIERO PONERLE LA CONDICION DE QUE ABRA EL COMPONENTE.MXML Y OCULTE EL LOGIN
   
   }
   else
   {
   Alert.show("Tu información no es correcta");
   }


Y PERDONEN SI les quito mucho su tiempo por entrar y apoyarme con este codigo soy algo nuevo en esto

Por juramy

Claber

217 de clabLevel

2 tutoriales

 

Programador

msie8
Citar            
MensajeEscrito el 06 Feb 2010 11:45 pm

Por xcom

Claber

530 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Feb 2010 04:49 pm
si pero sigue sin validar nada U_U tiene que validar aunque sea algo cuando le de login me pase a otra ventana y esto no lo hace

Por juramy

Claber

217 de clabLevel

2 tutoriales

 

Programador

msie8
Citar            
MensajeEscrito el 08 Feb 2010 05:28 pm
este es el codigo completo veran que ya se puede hacer lo que quiero pero me sigue marcando el error en esta parte del codigo: es la parte de la validacion de los datos que ingresa

Código Flex :

if(userValidation.type == ValidationResultEvent.VALID && passwordValidation.type == ValidationResultEvent.VALID)
   {
   Alert.show("Tu informacion es valida");
//este pedasito se lo implemente para la validacion pero la sintaxis no es del todo buena soy nuevo en esto
    entrar.currentState='pag1';
   
   }
   else
   {
   Alert.show("Tu información no es correcta");
   }
}



prueben el codigo en alguna aplicacion mxml y funciona bien solo es ese pedasito de codigo

Código Flex :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="white" width="100%" height="100%" xmlns:views="views.*">
   
   <mx:states>
      <mx:State name="pag1">
         <mx:AddChild position="lastChild">
            <mx:Button x="324" y="303" label="Regresar" click="currentState=''"/>
         </mx:AddChild>
         <mx:SetEventHandler target="{entrar}" name="click" handler="currentState='pag'"/>
         <mx:RemoveChild target="{form1}"/>
      </mx:State>
   </mx:states>
   
   <mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
import mx.controls.Alert;
private function validateUser():void
{
   var userValidation:ValidationResultEvent = validUserName.validate();
   var passwordValidation:ValidationResultEvent = validPassword.validate();
   
   if(userValidation.type == ValidationResultEvent.VALID && passwordValidation.type == ValidationResultEvent.VALID)
   {
   Alert.show("Tu informacion es valida");
    entrar.currentState='pag1';
   
   }
   else
   {
   Alert.show("Tu información no es correcta");
   }
}
]]>
</mx:Script>
<mx:Form horizontalCenter="-20" verticalCenter="-50" id="form1">
<mx:FormItem label="Usuario: ">
<mx:TextInput id="myName"/>
</mx:FormItem>
<mx:FormItem label="Contraseña">
<mx:TextInput id="myPassword" displayAsPassword="true"/>
</mx:FormItem>
   <mx:FormItem width="244" height="26">
      <mx:Button click="validateUser()" label="Entrar"  cornerRadius="6" borderColor="#3A6F98" themeColor="#19306A" id="entrar"/>
   </mx:FormItem>
</mx:Form>

<mx:StringValidator id="validUserName" source="{myName}" property="text" triggerEvent=""/>
<mx:StringValidator id="validPassword" source="{myPassword}" property="text" triggerEvent="" minLength="3" maxLength="6" tooShortError="La contraseña debe ser mayor a 3 caracteres" tooLongError="El maximo de caracteres es de 6"/>
   
   
   
</mx:Application>

Por juramy

Claber

217 de clabLevel

2 tutoriales

 

Programador

msie8
Citar            
MensajeEscrito el 08 Feb 2010 06:23 pm
PROFIN JAJA ME SALIO DE PURO CHURRO!!!! JAJAJAJAJA =D ADJUNTO MI LOGIN PARA QUIEN LO NECESITE =) SALU2

Código Flex :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="white" width="100%" height="100%" xmlns:views="views.*">
   
   <mx:states>
      <mx:State name="Bienvenido">
         <mx:AddChild position="lastChild">
            <mx:Button x="324" y="303" label="Regresar" click="currentState=''"/>
         </mx:AddChild>
         <mx:SetEventHandler target="{entrar}" name="click" handler="currentState=''"/>
         <mx:RemoveChild target="{form1}"/>
      </mx:State>
   </mx:states>
   
   <mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
import mx.controls.Alert;
private function validateUser():void
{
   var userValidation:ValidationResultEvent = validUserName.validate();
   var passwordValidation:ValidationResultEvent = validPassword.validate();
   
   if(userValidation.type == ValidationResultEvent.VALID && passwordValidation.type == ValidationResultEvent.VALID)
   {
   Alert.show("Tu informacion es valida",(currentState='Bienvenido'));
   
   
   }
   else
   {
   Alert.show("Tu información no es correcta");
   }
}
]]>
</mx:Script>
<mx:Form horizontalCenter="-20" verticalCenter="-50" id="form1">
<mx:FormItem label="Usuario: ">
<mx:TextInput id="myName"/>
</mx:FormItem>
<mx:FormItem label="Contraseña">
<mx:TextInput id="myPassword" displayAsPassword="true"/>
</mx:FormItem>
   <mx:FormItem width="244" height="26">
      <mx:Button click="validateUser()" label="Entrar"  cornerRadius="6" borderColor="#3A6F98" themeColor="#19306A" id="entrar"/>
   </mx:FormItem>
</mx:Form>

<mx:StringValidator id="validUserName" source="{myName}" property="text" triggerEvent=""/>
<mx:StringValidator id="validPassword" source="{myPassword}" property="text" triggerEvent="" minLength="3" maxLength="6" tooShortError="La contraseña debe ser mayor a 3 caracteres" tooLongError="El maximo de caracteres es de 6"/>

//By Juramy Made in Mexico
   
</mx:Application>



Por juramy

Claber

217 de clabLevel

2 tutoriales

 

Programador

msie8

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.