views:

468

answers:

2

How can I show an confirmation message in Actionscript 3 ?

I use Adobe Flex 3 and as3 for Air application

A: 

You can use the Alert class for that.

Alert.show(...);
Christophe Herreman
+1  A: 
Alert.show("Are you sure?", "Title",
    mx.controls.Alert.YES | mx.controls.Alert.NO, this, alertEventHandler);

Then create an alertEventHandler with the following code:

function alertEventHandler(event:CloseEvent):void {
    if(event.detail == Alert.YES) {
        // pressed yes.
    }
}

Or check out a custom Dialog class: http://fatal-exception.co.uk/blog/?p=69

Pindatjuh
I get this error :1119: Access of possibly undefined property No through a reference with static type Class.
Waseem
http://livedocs.adobe.com/flex/3/langref/mx/controls/Alert.html, correct. Sorry for typo.
Pindatjuh