Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1
Windowing | 69

var options = new air.NativeWindowInitOptions( );
var login = null;

options.minimizable = false;
options.maximizable = false;
options.resizable = false;

login = new air.NativeWindow( false, options );

Not all the options an application may make use of appear as
initialization options. Additional options that may be
controlled on an instance ofNativeWindowitself include the
window title, whether or not it is always in front, and win-
dow sizing and positioning.


TIP
If you intend to manage the initial window size manual-
ly, it is best to start with an invisible window. Creating a
native window and then changing its positioning and lay-
out in the same block of code results in a quick flicker of
the window as it is initially painted and then relocated
and resized.

When using theNativeWindowclass, you have absolute control
over its appearance, behavior and content. If the window is to
be resized, the operating system will merely provide for the
handles and resizing operations. The size, position, content,
and layout of the window itself must be controlled by the
application. Depending on how the application needs to han-
dle resizing, the NativeWindowBoundsEvent.RESIZE or
NativeWindowBoundsEvent.RESIZING events may be used:


login.title = "Login";
login.alwaysInFront = false;
login.bounds = new window.runtime.flash.geom.Rectangle(
( air.Capabilities.screenResolutionX – 270 ) / 2,
( air.Capabilities.screenResolutionY – 150 ) / 2,
270,
150 );
login.visible = true;
Free download pdf