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()); } }
[旧文存档]多维度的IF语句重构 <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.