Home > Adobe Flex/Air > Flex custom Alert message

Flex custom Alert message

How do you feel about the default Flex Alert box? i think it’s kind of simple, don’t you?

Udayms give us an amazing customize of it from here. His example works fine except with Confirm message. Even if yes or no is selected, nothing seem to happen. I don’t know if i missed something but after trying to look around finally i figured it out.

public static function confirm(message:String, parent:Sprite=null, closehandler:Function=null):void{
   //show(message, "Confirmation", Alert.YES | Alert.NO, null, closehandler, iconConfirm);
   show(message,  'Confirmation',  Alert.OK| Alert.CANCEL, null,  closehandler,  iconConfirm, Alert.OK);

By replacing Alert.YES/Alert.No by Alert.OK/Alert.CANCEL it seems work in my case.

Click here to download source code.

Categories: Adobe Flex/Air Tags:
  1. September 4, 2009 at 11:10 AM

    I have implemented your changes for the confirm alert…however i get the same behavior no matter which button I hit… could please give me an example of the confirm alert that has a closehandler with a param being passed to the closehandler function i.e alert.confirm(‘message’, doFunction(param)) this does not work for me!!

    • Phu
      September 4, 2009 at 1:06 PM

      Hi Lugene,
      I don’t know the reason why you have to pass parameters through CloseHandler? can you give me more information on your scenario so we can discuss and maybe have a better solution for it.

      There was my mistake on the Alert confirm code, please confirm again. Below is my source code show you how to use the confirm message box


      import flexed.widgets.alerts.alert;
      import mx.controls.Alert;
      public function showAlert():void {
           alert.confirm("Do you really want to process?", doAction);
      private function doAction(event:Object):void {
           if (event.detail == Alert.OK) {
           } else {


      <mx:Button label="Test Alert Confirm" click="showAlert()" />
  2. March 27, 2011 at 3:48 PM

    Can anyone help me to make my MS-Outlook type mail popup?

    concept is it will appear when button is clicked, after sometime it will disappear, same like MS-Outlook

  1. July 18, 2010 at 1:12 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: