Tuesday, April 12, 2011

Working with menus in AIR: Part 5

Today we'll learn how to configure the taskbar menu for an application.

The taskbar menu is the menu that can be opened from the system tray in Windows, or from the dock in OS X.

To create it, all you need to do is create a NativeMenu object like usual, and then simply apply it to the tray. You can apply it like this:

NativeApplication.nativeApplication.icon.menu = myMenu;

You can also set the tooltip of the taskbar item using the tooltip property of the native application:

NativeApplication.nativeApplication.icon.tooltip = "Application tooltip";

You can set an icon for the system tray by creating a BitmapData object and adding it to the bitmaps property of the native application. This property needs to hava an Array value for different sizes of the icon.

NativeApplication.nativeApplication.icon.bitmaps = new Array(icon16.bitmapData, icon128.bitmapData);

You can read about creating BitmapData objects here.

That's all for now.

Thanks for reading!

Related:

Working with menus in AIR: Part 1
Working with menus in AIR: Part 2
Working with menus in AIR: Part 3
Working with menus in AIR: Part 4
Working with menus in AIR: Part 6

No comments:

Post a Comment