Apr 20

接下来的例子演示了如何显示一个Alert对话框以及如何用Alert.noLabelAlert.yesLabel属性, 重新设置对话框中按钮的显示名称。

让我们先来看一下Demo(可以右键View Source或点击这里察看源代码


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="showAlert()">
  3.  
  4.     <mx:Script>
  5.         <![CDATA[
  6.             import mx.controls.Alert;
  7.  
  8.             private var a:Alert;
  9.  
  10.             private function showAlert():void {
  11.                 Alert.noLabel = "Non";
  12.                 Alert.yesLabel = "Oui";
  13.  
  14.                 Alert.show("message goes here", "title goes here", Alert.NO | Alert.YES);
  15.             }
  16.         ]]>
  17.     </mx:Script>
  18.  
  19.     <mx:Button label="Alert.show()" click="showAlert();" />
  20.  
  21. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer

written by Minidxer  |  tags: , , , , , ,

Related Post

Leave a Reply