4

How can I show an confirmation message in Actionscript 3 ?

I use Adobe Flex 3 and as3 for Air application

Waseem
  • 11,741
  • 15
  • 41
  • 45

2 Answers2

5
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
  • 10,550
  • 1
  • 41
  • 68
  • I get this error : 1119: Access of possibly undefined property No through a reference with static type Class. – Waseem Mar 06 '10 at 14:56
  • http://livedocs.adobe.com/flex/3/langref/mx/controls/Alert.html, correct. Sorry for typo. – Pindatjuh Mar 06 '10 at 15:39
0

You can use the Alert class for that.

Alert.show(...);
Christophe Herreman
  • 15,895
  • 9
  • 58
  • 86