Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
Developer
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Is there a buttonless AlertDialog type notification class?

I was wondering if there was a buttonless AlertDialog type notification class?  I want to be able to overlay a quick message that disapears in a few seconds but requires no user interaction.

 

e.g. I just want to display an overlay message like:

 

 

"Oh noes! - there were no results found"

 

but have it auto dismiss in 2 seconds.

 

I've got no problem "inventing" this object if it doesn't exist but figured I'd ask the experts if there was already something that fits the bill.

 

Cheers,

Steve


PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Is there a buttonless AlertDialog type notification class?

[ Edited ]

hey steve,

 

you can use the current AlertDialog class to do what you want using a simple timer and the cancel() method. in the code below, after you hit the click me button, it'll up a alert dialog and then make it disapear in 1 second:

 

DialogTest.as:

 

 

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    import qnx.dialog.AlertDialog;
    import qnx.dialog.DialogAlign;
    import qnx.dialog.DialogSize;
    import qnx.display.IowWindow;
    import qnx.ui.buttons.LabelButton;
    
    
    [SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
    public class DialogTest extends Sprite
    {
        private var alert:AlertDialog;
        private var timer:Timer;
        
        public function DialogTest()
        {
            super();
            
            // support autoOrients
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            
            var myBtn:LabelButton = new LabelButton();
            
            myBtn.label = "Click Me";
            myBtn.setPosition(100,100);
            myBtn.setSize(100,50);
            
            myBtn.addEventListener(MouseEvent.CLICK, showAlertDialog);
            
            addChild(myBtn);
        }
        
        private function showAlertDialog(e:MouseEvent):void
        {
            alert = new AlertDialog();
            alert.title = "Message";
            alert.message = "Oh noes! - there were no results found";
            alert.dialogSize= DialogSize.SIZE_SMALL;
            alert.show(IowWindow.getAirWindow().group);
            
            timer = new Timer(1000);
            
            timer.start();
            
            timer.addEventListener(TimerEvent.TIMER, onTimer);
        }
        
        private function onTimer(e:TimerEvent):void
        {
            timer.removeEventListener(TimerEvent.TIMER, onTimer);
            timer.stop();
            alert.cancel();
        }

    }
}

 

hope that helps. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman