Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1
Application Chrome | 63

Discussion


While Adobe AIR allows developers to completely define and
customize the application’s window chrome, it is important
to remember that the application is responsible for every type
of windowing event that might normally occur. This means
connecting the various visual elements with their respective
operating system events.


TheNativeWindowinstance that represents the main applica-
tion window is not directly accessible from inside the main
HTML DOM. Using AIR APIs, an application can traverse
outside of the HTML control, out to theStage, and get a ref-
erence to itsNativeWindowinstance. Once a reference to the
native window has been obtained, the appropriate methods
can be called to trigger the operating-system specific event
(or vice versa). In the case of being able to minimize the win-
dow, the application can useNativeWindow.minimize( )and
NativeWindow.close( ) in the case of closing:


window.htmlControl.stage.window.minimize( );
window.htmlControl.stage.window.close( );

The NativeWindow.close( ) event does not necessarily
terminate the application. If only one application window is
available, the application will terminate. If there are multiple
windows, they will close until only one window remains.
Closing the last window terminates the application.


application.xml


<?xml version="1.0" encoding="utf-8" ?>
<application
xmlns="http://ns.adobe.com/air/application/1.0.M4"
appId="com.adobe.demo.html.CustomChrome"
version="1.0 Beta">

<name>Custom Chrome</name>
<title>Custom Chrome</title>

<rootContent
visible="true"
transparent="true"
Free download pdf