标签:style http os 使用 io strong ar for 数据
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:Validator source="{username}" property="text" required="true"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Enter your name:"/> <s:TextInput id="username"/> <s:TextInput/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:StringValidator property="text" source="{username}" minLength="3" maxLength="20" trigger="{submitButton}" triggerEvent="click" tooLongError="too long , longer than 20" tooShortError="too short, shoter than 3"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Enter your name:"/> <s:TextInput id="username"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:NumberValidator source="{age}" property="text" allowNegative="false" negativeError="not allow negative" maxValue="110" minValue="5" domain="int" trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Enter your age:"/> <s:TextInput id="age"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:DateValidator monthSource="{month}" monthProperty="value" daySource="{day}" dayProperty="value" yearSource="{year}" yearProperty="text" trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:HGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Month:"/> <s:NumericStepper id="month"/> <s:Label text="Day:"/> <s:NumericStepper id="day"/> <s:Label text="Year:"/> <s:TextInput id="year" width="60"/> <s:Button label="Submit" id="submitButton"/> </s:HGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:EmailValidator source="{email}" property="text" invalidCharError="you‘ve got some funky characters" trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Email:"/> <s:TextInput id="email"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:CreditCardValidator cardNumberSource="{cardNumber}" cardNumberProperty="text" cardTypeSource="{cardType}" cardTypeProperty="selectedItem" trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:DropDownList id="cardType" width="150"> <mx:ArrayCollection> <fx:String>American Express</fx:String> <fx:String>Visa</fx:String> <fx:String>Diners Club</fx:String> <fx:String>Discover</fx:String> <fx:String>MasterCard</fx:String> </mx:ArrayCollection> </s:DropDownList> <s:Label text="Card Number:"/> <s:TextInput id="cardNumber"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:CurrencyValidator source="{income}" property="text" allowNegative="false" negativeError="dont support negative income..." precision="2" precisionError="support 2 decimals only." trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="How much do you make?"/> <s:TextInput id="income"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:PhoneNumberValidator source="{phone}" property="text" trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="What number can we reach you at?"/> <s:TextInput id="phone"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:RegExpValidator source="{ssn}" property="text" flags="gmi" expression="\d\{3\}.\d\{2\}.\d\{4\}" noMatchError="Your SSN is unrecognized." trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Social Security Number:"/> <s:TextInput id="ssn"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Script> <![CDATA[ import mx.events.ValidationResultEvent; import mx.validators.RegExpValidationResult; import mx.controls.Alert; private function handleValidation(event:ValidationResultEvent):void { var oneResult:RegExpValidationResult; for(var i:int = 0; i < event.results.length; i++) { oneResult = event.results[i]; Alert.show("Found a match at Index:" + oneResult.matchedIndex + "\n On character of : " + oneResult.matchedString, "RegEx Results", Alert.NONMODAL); } } ]]> </fx:Script> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:RegExpValidator source="{test}" property="text" flags="gmi" valid="handleValidation(event)" expression="m[ai]n" noMatchError="I don‘t like it!" trigger="{submitButton}" triggerEvent="click"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Try me:"/> <s:TextInput id="test"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:StringValidator source="{address}" minLength="5" property="text" trigger="{address}" triggerEvent="change"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="What your address:"/> <s:TextInput id="address"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:StringValidator source="{address}" minLength="5" property="text" trigger="{address}" triggerEvent="valueCommit"/> </fx:Declarations> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="What your address:"/> <s:TextInput id="address"/> <s:Button label="Submit" id="submitButton"/> </s:VGroup> </s:Application>
<?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"> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.ValidationResultEvent; import mx.validators.EmailValidator; import mx.validators.StringValidator; 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 = 6; emailVal.source = email; emailVal.property = "text"; valResult = emailVal.validate(); if(valResult.type == "invalid") { Alert.show("Please fix your email address:"); } else { valResult = stringVal.validate(); if(valResult.type == "invalid") { Alert.show("Please fix your Username."); } } } ]]> </fx:Script> <s:VGroup horizontalCenter="0" verticalCenter="0"> <s:Label text="Email :"/> <s:TextInput id="email"/> <s:Label text="Your name:"/> <s:TextInput id="username"/> <s:Button label="Submit" id="submitButton" click="validateForm()"/> </s:VGroup> </s:Application>
标签:style http os 使用 io strong ar for 数据
原文地址:http://my.oschina.net/xuleo/blog/308316