📄 forgotpasswordpanel.mxml
字号:
<?xml version="1.0" encoding="utf-8"?>
<components:FlexDotOrgWindow
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="com.flexShowcase.components.*"
xmlns:remote="com.flexShowcase.net.remote.*"
width="380"
height="200"
label="Forgot My Password"
>
<mx:Script>
<![CDATA[
//////////////////////////////////////////////////
//import
import com.flexShowcase.constants.TextRestrictions;
import com.flexShowcase.net.remote.FlexShowcaseServiceConfig;
import mx.controls.Alert;
import mx.effects.Fade;
import mx.events.*;
import mx.validators.Validator;
import mx.rpc.events.*;
//////////////////////////////////////////////////
//public variables
[Bindable] public var flexShowcaseServiceConfig:FlexShowcaseServiceConfig;
//////////////////////////////////////////////////
//private variables
[Bindable] private var formIsValid:Boolean;
private var focussedFormControl:DisplayObject;
//////////////////////////////////////////////////
//overridden functions
override public function show():void {
super.show()
email.text = "";
email.errorString = "";
focusManager.setFocus(email);
}
//////////////////////////////////////////////////
//private functions
private function hideCompleteHandler(tweenEvent:TweenEvent):void {
visible = false;
}
private function cancelClickHandler(mouseEvent:MouseEvent):void {
hide();
}
//validation--------------------------------------
private function validateForm(event:Event):void {
focussedFormControl = event.target as DisplayObject;
formIsValid = true;
validate(emailValidator);
}
private function validate(validator:Validator):Boolean {
var validatorSource:DisplayObject = validator.source as DisplayObject;
var suppressEvents:Boolean = (validatorSource != focussedFormControl);
var event:ValidationResultEvent = validator.validate(null, suppressEvents);
var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID);
formIsValid = formIsValid && currentControlIsValid;
return currentControlIsValid;
}
private function submitClickHandler(mouseEvent:MouseEvent):void {
userService.user.resetPassword.addEventListener(ResultEvent.RESULT, userResultHandler);
userService.user.resetPassword.addEventListener(FaultEvent.FAULT, userFaultHandler);
userService.user.resetPassword(email.text);
hide();
Alert.buttonHeight = 31;
Alert.show("Please check your email for your new password.");
}
private function userResultHandler(event:Event):void {
userService.user.resetPassword.removeEventListener(ResultEvent.RESULT, userResultHandler);
userService.user.resetPassword.removeEventListener(FaultEvent.FAULT, userFaultHandler);
}
private function userFaultHandler(event:Event):void {
userService.user.resetPassword.removeEventListener(ResultEvent.RESULT, userResultHandler);
userService.user.resetPassword.removeEventListener(FaultEvent.FAULT, userFaultHandler);
}
]]>
</mx:Script>
<mx:EmailValidator id="emailValidator" source="{email}" property="text" />
<remote:UserService id="userService" flexShowcaseServiceConfig="{flexShowcaseServiceConfig}" />
<mx:VBox width="100%">
<mx:Text styleName="flexDarkLabel" text="Enter your email to receive your new password." width="220"/>
<mx:HBox width="100%">
<mx:HBox width="30" horizontalAlign="right">
<mx:Label text="Email" styleName="flexDarkLabel"/>
</mx:HBox>
<mx:HBox width="100%">
<mx:TextInput id="email" styleName="flexDarkTextBox" maxChars="{TextRestrictions.SMALL}"
width="100%" change="validateForm(event)" />
</mx:HBox>
</mx:HBox>
<mx:HBox bottom="40" horizontalAlign="center" width="100%" paddingTop="14">
<mx:Button id="submit" label="Submit" styleName="blackButton" width="90"
enabled="{formIsValid}" buttonMode="{formIsValid}" click="submitClickHandler(event);"/>
<mx:Button id="cancel" label="Cancel" styleName="blackButton" width="90"
buttonMode="true" click="cancelClickHandler(event);"/>
</mx:HBox>
</mx:VBox>
</components:FlexDotOrgWindow>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -