13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Taskbar icons in AIR<br />

Highlighting the taskbar window button<br />

Adobe AIR 1.0 and later<br />

Wh<strong>en</strong> a window is in the background, you can notify the user that an ev<strong>en</strong>t of interest related to the window has<br />

occurred. On Mac OS X, you can notify the user by bouncing the application dock icon (as described in “Bouncing the<br />

dock” on page 648). On Windows and Linux, you can highlight the window taskbar button by calling the<br />

notifyUser() method of the NativeWindow instance. The type parameter passed to the method determines the<br />

urg<strong>en</strong>cy of the notification:<br />

NotificationType.CRITICAL: the window icon flashes until the user brings the window to the foreground.<br />

NotificationType.INFORMATIONAL: the window icon highlights by changing color.<br />

Note: On Linux, only the informational type of notification is supported. Passing either type value to the<br />

notifyUser() function will create the same effect.<br />

The following statem<strong>en</strong>t highlights the taskbar button of a window:<br />

stage.nativeWindow.notifyUser(NotificationType.CRITICAL);<br />

Calling the NativeWindow.notifyUser() method on an operating system that does not support window-level<br />

notification has no effect. Use the NativeWindow.supportsNotification property to determine if window<br />

notification is supported.<br />

Creating windows without taskbar buttons or icons<br />

Adobe AIR 1.0 and later<br />

On the Windows operating system, windows created with the types utility or lightweight do not appear on the taskbar.<br />

Invisible windows do not appear on the taskbar, either.<br />

Because the initial window is necessarily of type, normal, in order to create an application without any windows<br />

appearing in the taskbar, you must either close the initial window or leave it invisible. To close all windows in your<br />

application without terminating the application, set the autoExit property of the NativeApplication object to false<br />

before closing the last window. To simply prev<strong>en</strong>t the initial window from ever becoming visible, add<br />

false to the elem<strong>en</strong>t of the application descriptor file (and do not set the<br />

visible property to true or call the activate() method of the window).<br />

In new windows op<strong>en</strong>ed by the application, set the type property of the NativeWindowInitOption object passed to<br />

the window constructor to NativeWindowType.UTILITY or NativeWindowType.LIGHTWEIGHT.<br />

On Mac OS X, windows that are minimized are displayed on the dock taskbar. You can prev<strong>en</strong>t the minimized icon<br />

from being displayed by hiding the window instead of minimizing it. The following example list<strong>en</strong>s for a<br />

nativeWindowDisplayState change ev<strong>en</strong>t and cancels it if the window is being minimized. Instead the handler sets<br />

the window visible property to false:<br />

private function prev<strong>en</strong>tMinimize(ev<strong>en</strong>t:NativeWindowDisplayStateEv<strong>en</strong>t):void{<br />

if(ev<strong>en</strong>t.afterDisplayState == NativeWindowDisplayState.MINIMIZED){<br />

ev<strong>en</strong>t.prev<strong>en</strong>tDefault();<br />

ev<strong>en</strong>t.target.visible = false;<br />

}<br />

}<br />

If a window is minimized on the Mac OS X dock wh<strong>en</strong> you set the visible property to false, the dock icon is not<br />

removed. A user can still click the icon to make the window reappear.<br />

Last updated 6/6/2012<br />

651

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!