Sagar Rawal
Sagar Rawal

Reputation: 1442

Create a Notification window in Adobe AIR Application

I want to create an AIR application in which i need to show the notification that when AIR application is minimize then at some interval of time message shows from the system tray similar like giving information.

I have visited this LINK, its a nice component but tutorial is not that much good as component. I need to create a component like that or source is available from this site so modification in this component will also be acceptable. so please help me.

EG: When you minimize the Yahoo Messenger and some one is sign-out or sign-in then it gives notification i want component similar like that...

Thanks in Advance

Upvotes: 3

Views: 2538

Answers (1)

Dinesh
Dinesh

Reputation: 2066

First Step, We have created a Custom Popup control for Notifications display.

In the second step, we have controlled the display of that popup using the following code

if(!this.stage.nativeWindow.visible || this.stage.nativeWindow.displayState == NativeWindowDisplayState.MINIMIZED)
{
    stage.nativeWindow.alwaysInFront = true;
    fadeTimer = new Timer(5000,1);
    fadeTimer.start();
    fadeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, fadePopUp);

    popUpWindow = new PopUpWindow();
    popUpWindow.isAlerts = true;
    popUpWindow.Message = "<b>You have "+event.numNewMessages+" new notification messages<b>";

    popUpWindow.type = NativeWindowType.LIGHTWEIGHT;
    popUpWindow.open(true);
    popUpWindow.fadeInEffect.play();            
    popUpWindow.nativeWindow.x = Capabilities.screenResolutionX - popUpWindow.width - 10;
    popUpWindow.nativeWindow.y = Capabilities.screenResolutionY - popUpWindow.height - 35;
}

The condition used above is what we have used to find out, whether our application window is minimized to System Tray or not. Even though it is not a perfect fix, It didn't fail me yet. It's quiet stable for my app.

Upvotes: 2

Related Questions