import mx.validators.EmailValidator;
import mx.validators.StringValidator;
import mx.controls.Alert;
import mx.events.ValidationResultEvent;
public var emailVal:EmailValidator = new EmailValidator();
public var stringVal:StringValidator = new StringValidator();
public function validateForm():void
{
var valResult:ValidationResultEvent;
stringVal.source = username;
stringVal.property = "text";
stringVal.minLength = 10;
emailVal.source = email;
emailVal.property = "text";
valResult = emailVal.validate();
if(valResult.type == "invalid"){
Alert.show("Invalid Email");
}
valResult = stringVal.validate();
if(valResult.type == "invalid"){
Alert.show("Invalid Username");
}
}