⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contactform.mxml

📁 flex编程学习以及应用很好的源码
💻 MXML
字号:
<!--   Copyright 2007, Firemoss, LLC   Licensed under the Apache License, Version 2.0 (the "License");   you may not use this file except in compliance with the License.   You may obtain a copy of the License at       http://www.apache.org/licenses/LICENSE-2.0   Unless required by applicable law or agreed to in writing, software   distributed under the License is distributed on an "AS IS" BASIS,   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   See the License for the specific language governing permissions and   limitations under the License.--><mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ac="com.adobe.ac.*"><mx:Script><![CDATA[import mx.controls.Alert;import mx.events.ValidationResultEvent;import com.firemoss.modelglue.examples.contactmanager.model.ContactTO;[Bindable]public var contact:ContactTO;private var _dataChanged:Boolean = false;[Bindable]public function set dataChanged(value:Boolean):void {	this._dataChanged = value;}public function get dataChanged():Boolean {	return this._dataChanged;}private function formValueChanged():void {	this.dataChanged = true;}public function get isValid():Boolean {	var valid:Boolean = true;	if (firstnameValidator.validate().type == ValidationResultEvent.INVALID) valid = false;	if (lastnameValidator.validate().type == ValidationResultEvent.INVALID) valid = false;	if (phoneValidator.validate().type == ValidationResultEvent.INVALID) valid = false;	if (emailValidator.validate().type == ValidationResultEvent.INVALID) valid = false;		return valid;}private function resetValidation():void {	if (this.firstname) {		this.firstname.errorString = null;			this.lastname.errorString = null;			this.phone.errorString = null;			this.emailAddress.errorString = null;		}}public function applyChanges():void {	this.contact.firstname = this.firstname.text;	this.contact.lastname = this.lastname.text;	this.contact.phone = this.phone.text;	this.contact.emailAddress = this.emailAddress.text;}public function undoChanges():void {	this.firstname.text = this.contact.firstname;	this.lastname.text = this.contact.lastname;	this.phone.text = this.contact.phone;	this.emailAddress.text = this.contact.emailAddress;		this._dataChanged = false;	this.resetValidation();}private function contactChanged(c:ContactTO):void {	this.resetValidation()}]]></mx:Script><ac:Observe source="{this.contact}" handler="contactChanged" /><mx:StringValidator id="firstnameValidator" source="{firstname}" property="text" maxLength="50" required="true" /><mx:StringValidator id="lastnameValidator" source="{lastname}" property="text" maxLength="50" required="true" /><mx:StringValidator id="phoneValidator" source="{phone}" property="text" maxLength="50" required="true" /><mx:EmailValidator id="emailValidator" source="{emailAddress}" property="text" /><mx:Form width="90%">	<mx:FormItem label="First Name" width="100%">		<mx:TextInput id="firstname" text="{this.contact.firstname}" maxChars="50" width="100%" change="this.formValueChanged()" />	</mx:FormItem>	<mx:FormItem label="Last Name" width="100%">		<mx:TextInput id="lastname" text="{this.contact.lastname}" maxChars="50" width="100%" change="this.formValueChanged()" />	</mx:FormItem>	<mx:FormItem label="Phone Number" width="100%">		<mx:TextInput id="phone" text="{this.contact.phone}" maxChars="50" width="100%" change="this.formValueChanged()" />	</mx:FormItem>	<mx:FormItem label="E-Mail Address" width="100%">		<mx:TextInput id="emailAddress" text="{this.contact.emailAddress}" maxChars="50" width="100%" change="this.formValueChanged()" />	</mx:FormItem></mx:Form>	</mx:VBox>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -