Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/12/2010, 23:14
tazzwt
 
Fecha de Ingreso: marzo-2010
Mensajes: 432
Antigüedad: 14 años, 1 mes
Puntos: 11
validaciones de ingreso con Flex 3

Flex 3 o superior.

Hola como se pueden hacer validaciones simples con Flex.

tal como se hacen en javascript con html.

Como la imagen:



aparezca un alert diciendo si es correcto o no es correcto.

Código Flex:
Ver original
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  3.                xmlns:s="library://ns.adobe.com/flex/spark"
  4.                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
  5.     <fx:Declarations>
  6.        
  7.         <mx:Script>
  8.             <![CDATA[        
  9.             import mx.controls.Alert;
  10.            
  11.             private function valida_vacios():void {
  12.             myInput.text == "";
  13.             Alert.show("Ingrese un numero", "Error", Alert.OK);
  14.             }
  15.             ]]>
  16.         </mx:Script>
  17.        
  18.         <mx:Button x="96" y="109" id="myButton"                  
  19.                    click="valida_vacios();"/>
  20.        
  21.         <s:Label x="17" y="22" text="Ingreso No Vacio" id="myInput" />
  22.         <s:Label x="19" y="58" text="Solo Numeros"/>
  23.         <s:TextInput x="119" y="17"/>
  24.         <s:TextInput x="112" y="48"/>
  25.         <s:Label x="19" y="88" text="Solo Letras"/>
  26.         <s:TextInput x="96" y="78"/>
  27.        
  28.         <!-- Place non-visual elements (e.g., services, value objects) here -->
  29.     </fx:Declarations>
  30. </s:Application>
__________________
Libro de HTML 5 + codigo fuente bajar aqui.