Home » ActionScript 3.0, AIR

Adobe AIR application + without appearing in Taskbar

11 November 2008 One Comment
Share on Facebook

While creating widgets the application should not appear on taskbar. But with AIR there is no such option to get rid of the application from taskbar.
I was searching the internet and I could find for Flex + AIR, but I could not find for Flash + AIR.

Create Widgets using Adobe Air

Here comes the Utility and Lightweight windows in action, these are type of native window but they will not appear on the taskbar.

But with only utility and lightweight windows we cannot  make an application.
Initially we need to load our usual AIR application and close it launch a utility window and add contents to it that’s the trick.

Standard Window:

this.stage.nativeWindow.close()
var nativeWindowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
nativeWindowOptions.type = NativeWindowType.UTILITY;
nativeWindowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
var _nativeWindow:NativeWindow = new NativeWindow(nativeWindowOptions);
_nativeWindow.width = 300;
_nativeWindow.height = 300;
_nativeWindow.x = 400;
_nativeWindow.y = 300;
_nativeWindow.stage.align = "TL";
_nativeWindow.stage.scaleMode = "noScale";
_nativeWindow.title = "I am not at TaskBar";
_nativeWindow.stage.addChild(new rose())
_nativeWindow.activate();

Explanation:
Here, we are closing the original NativeWindow
this.stage.nativeWindow.close()
And setting new nativewindow options, creating the new nativewindow.
One important thing to note here is to set the scalemode of the stage noScale otherwise the contents inside the newwindow is scaled.
Adding content to Utility or LightWeightWindow using
NativeWindow.stage.addChild( MovieClip, Sprite );
At last we need to activate the window using
NativeWindow.activate();

Download Source file

Custom Window:


While creating the custom window we should give an option to exit the application. Otherwise it will affect usability.

this.stage.nativeWindow.close()
var nativeWindowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
nativeWindowOptions.type = NativeWindowType.UTILITY;
nativeWindowOptions.systemChrome = NativeWindowSystemChrome.NONE;
nativeWindowOptions.transparent = true
var _nativeWindow:NativeWindow = new NativeWindow(nativeWindowOptions);
_nativeWindow.width = 300;
_nativeWindow.height = 300;
_nativeWindow.x = 400;
_nativeWindow.y = 300;
_nativeWindow.stage.align = "TL";
_nativeWindow.stage.scaleMode = "noScale";
_nativeWindow.title = "I am not at TaskBar";
_nativeWindow.stage.addChild(new rose())
var _closeMC:closeMC = new closeMC();
_closeMC.x = 140
_closeMC.addEventListener(MouseEvent.CLICK, closeWindow)
_nativeWindow.stage.addChild( _closeMC );
_nativeWindow.activate();
function closeWindow( e:MouseEvent )
{
_nativeWindow.close();
}

Explanation:
Setting systemChrome option to NONE and transparent property to true will remove the title bar too.
nativeWindowOptions.systemChrome = NativeWindowSystemChrome.NONE;
nativeWindowOptions.transparent = true
And to close the native window
NativeWindow.close();

Download Source files

GET THE UPDATES VIA EMAIL

We don't share your email anywhere, grab our rss via feedburner


Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.