class="article_content clearfix">
class="htmledit_views">
class="blog_title">
class="" title="">Alert的参考
class="" title="">简单的alert提示框说起.
class="" title="">Alert的参考
http://livedocs.adobe.com/class="tags" href="/tags/FLEX.html" title=flex>flex/3/langref/mx/controls/Alert.html#effectSummary
Alert.show(text, title, flags, parent, closeHandler(关闭时触发的事件));
flag : Alert.YES|Alert.NO|Alert.OK
class="" title="">
class="" title="">简单的alert提示框说起.
先一起来看看官方文档的介绍:
public static show(
text:String,
title:String = class="tags" href="/tags/NULL.html" title=null>null,
flags:uint = mx.controls.Alert.OK,
parent:Sprite = class="tags" href="/tags/NULL.html" title=null>null,
clickListener:Function = class="tags" href="/tags/NULL.html" title=null>null,
iconClass:Class = class="tags" href="/tags/NULL.html" title=null>null,
defaultButton:uint = mx.controls.Alert.OK) : Alert
alert提供了一个主要的方法,就是show()方法,其实中的参数都已经很明白地列出来了,下面我自己能过一个小例子,将上面的应用进去,大家也可以发挥自己的想像,动手来试试;
class="blog_content">
class="dp-highlighter">
class="bar">
class="tools">
Java代码

- class="dp-j">
- <?xml version=class="class="tags" href="/tags/STRING.html" title=string>string">"1.0" class="tags" href="/tags/ENCODING.html" title=encoding>encoding=class="class="tags" href="/tags/STRING.html" title=string>string">"utf-8"?>
- <mx:Application xmlns:mx=class="class="tags" href="/tags/STRING.html" title=string>string">"http://www.adobe.com/2006/mxml" layout=class="class="tags" href="/tags/STRING.html" title=string>string">"absolute" width=class="class="tags" href="/tags/STRING.html" title=string>string">"100%" height=class="class="tags" href="/tags/STRING.html" title=string>string">"100%">
- <mx:Script>
- <![CDATA[
- class="keyword">import mx.events.CloseEvent;
- class="keyword">import mx.controls.Alert;
- [Embed(source=class="class="tags" href="/tags/STRING.html" title=string>string">"img/over.png")]
- [Bindable]
- class="keyword">private var btn:Class;
- class="keyword">private function doubleClickHandler(event:Event):class="keyword">void{
- Alert.okLabel=class="class="tags" href="/tags/STRING.html" title=string>string">"确定";
- Alert.cancelLabel=class="class="tags" href="/tags/STRING.html" title=string>string">"取消";
- Alert.show(class="class="tags" href="/tags/STRING.html" title=string>string">"您双击了我",
- class="class="tags" href="/tags/STRING.html" title=string>string">"我的提示信息",
- Alert.OK|Alert.CANCEL,
- class="keyword">this,
- closeHandlerEvent,btn,Alert.OK);
- event.currentTarget.title=class="class="tags" href="/tags/STRING.html" title=string>string">"您双击了我";
- }
- class="keyword">private function closeHandlerEvent(event:CloseEvent):class="keyword">void{
- class="keyword">if(event.detail==Alert.OK){
- testLabel.text=class="class="tags" href="/tags/STRING.html" title=string>string">"您选的是OK";
- }class="keyword">else class="keyword">if(event.detail==Alert.CANCEL){
- testLabel.text=class="class="tags" href="/tags/STRING.html" title=string>string">"您选的是Cancel";
- }
- }
- ]]>
- </mx:Script>
- <mx:Panel title=class="class="tags" href="/tags/STRING.html" title=string>string">"MyTest"
- textAlign=class="class="tags" href="/tags/STRING.html" title=string>string">"center"
- doubleClick=class="class="tags" href="/tags/STRING.html" title=string>string">"doubleClickHandler(event);"
- fontSize=class="class="tags" href="/tags/STRING.html" title=string>string">"13"
- doubleClickEnabled=class="class="tags" href="/tags/STRING.html" title=string>string">"true"
- verticalAlign=class="class="tags" href="/tags/STRING.html" title=string>string">"middle"
- horizontalAlign=class="class="tags" href="/tags/STRING.html" title=string>string">"center"
- paddingBottom=class="class="tags" href="/tags/STRING.html" title=string>string">"0" paddingTop=class="class="tags" href="/tags/STRING.html" title=string>string">"0" paddingLeft=class="class="tags" href="/tags/STRING.html" title=string>string">"0" paddingRight=class="class="tags" href="/tags/STRING.html" title=string>string">"0"
- width=class="class="tags" href="/tags/STRING.html" title=string>string">"100%" height=class="class="tags" href="/tags/STRING.html" title=string>string">"100%">
- <mx:Label id=class="class="tags" href="/tags/STRING.html" title=string>string">"testLabel" text=class="class="tags" href="/tags/STRING.html" title=string>string">"TestLabel" fontWeight=class="class="tags" href="/tags/STRING.html" title=string>string">"bold" fontSize=class="class="tags" href="/tags/STRING.html" title=string>string">"24"/>
- </mx:Panel>
- </mx:Application>