actionscript-application-flickr-ui-search-SearchValidator.ax [swf] flex
package { /* * @ax-actionscript-application-flickr-ui-search-SearchValidator * * The @ax-actionscript-application-flickr-ui-search-SearchValidator is used by the SearchPanel to check the tags * and userName fields to make sure both are not blank. Either of them * can be empty, just not both of them. */ import mx.validators.Validator; import mx.validators.ValidationResult; public class @ax-actionscript-application-flickr-ui-search-SearchValidator extends Validator { private var results:Array; public function @ax-actionscript-application-flickr-ui-search-SearchValidator() { super(); } public var userName:String; public var tags:String; override protected function doValidation(value:Object) : Array { var tagField:String = tags; var userField:String= userName; // Clear results Array. results = []; // make sure both fields are not empty. Either field may // be empty, but both cannot be empty. if( (tagField == null || tagField.length == 0) && (userField == null || userField.length == 0) ) { results.push( new ValidationResult(true,"sub","code", "Either search tags or user name may be blank, but not both")); } return results; } } }
(C) Æliens 27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.