[旧文存档]Flex: Alert 使用总结 Using Alert in Flex

Categories: Flex; Tagged with: ; @ August 29th, 2010 18:17

1. 通过Alert强制用户选择.

2. 使用一个方法 Handle多个Alert.

 
 
// 弹出Alert
			Alert.show(RM.getString(BUNDLE_ONLINE_TEST, "olt.attempt.warn.remove"), RM.getString(BUNDLE_ONLINE_TEST, "olt.confirm.title"),
				Alert.YES|Alert.CANCEL, null, onAlertClose).data = "remove";
//----------------------统一响应---------------------------------
 
	// onWarning Close
	private function onAlertClose(e:CloseEvent):void {
		if((e.target as Alert).data == "remove") {
			if(e.detail == Alert.YES) {
			...
			}else {
				// do nothing
			}
		}else if((e.target as Alert).data == ALERT_ATTEMPT) {
			if(e.detail == Alert.YES) {
				...
			}
		}else if((e.target as Alert).data == ALERT_GO_ON_ATTEMPT) {
			if(e.detail == Alert.YES) {
				...
			}
		}else {
			throw new Error("无法识别的Alert关闭类型: " + e.toString());
		}
	}

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.