flex validator 之通过性验证

注:原创作品,分享以供交流学习,转载请注明出处。

  通过性验证是在按下提交按钮的时候开始验证全部的组件。

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
		<mx:StringValidator source="{username}"
							property="text"
							minLength="6"
							trigger="{SubmitButton}"
							triggerEvent="click"
							/>
		<mx:EmailValidator source="{email}"
						   property="text"
						   trigger="{SubmitButton}"
						   triggerEvent="click"
						   />
	</fx:Declarations>
	
	<s:VGroup horizontalCenter="0" verticalCenter="0">
		<s:Label text="email:"/>
		<s:TextInput id="email"/>
		<s:Label text="userName"/>
		<s:TextInput id="username"/>
		<s:Button label="Submit" id="SubmitButton"/>
	</s:VGroup>
</s:Application>

你可能感兴趣的:(Flash)