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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Working with AIR native windows<br />

The static NativeWindow.supportsTranspar<strong>en</strong>cy property reports whether window transpar<strong>en</strong>cy is available.<br />

Wh<strong>en</strong> transpar<strong>en</strong>cy is not supported, the application is composited against a black background. In these cases, any<br />

transpar<strong>en</strong>t areas of the application display as an opaque black. It is a good practice to provide a fallback in case this<br />

property tests false. For example, you could display a warning dialog to the user, or display a rectangular, nontranspar<strong>en</strong>t<br />

user interface.<br />

Note that transpar<strong>en</strong>cy is always supported by the Mac and Windows operating systems. Support on Linux operating<br />

systems requires a compositing window manager, but ev<strong>en</strong> wh<strong>en</strong> a compositing window manager is active,<br />

transpar<strong>en</strong>cy can be unavailable because of user display options or hardware configuration.<br />

Transpar<strong>en</strong>cy in an MXML application window<br />

Adobe AIR 1.0 and later<br />

By default, the background of an MXML window is opaque, ev<strong>en</strong> if you create the window as transpar<strong>en</strong>t. (Notice the<br />

transpar<strong>en</strong>cy effect at the corners of the window.) To pres<strong>en</strong>t a transpar<strong>en</strong>t background for the window, set a<br />

background color and alpha value in the style sheet or elem<strong>en</strong>t contained in your application MXML file.<br />

For example, the following style declaration gives the background a slightly transpar<strong>en</strong>t gre<strong>en</strong> shade:<br />

WindowedApplication<br />

{<br />

background-alpha:".8";<br />

background-color:"0x448234";<br />

}<br />

Transpar<strong>en</strong>cy in an HTML application window<br />

Adobe AIR 1.0 and later<br />

By default the background of HTML cont<strong>en</strong>t displayed in HTML windows and HTMLLoader objects is opaque, ev<strong>en</strong>t<br />

if the containing window is transpar<strong>en</strong>t. To turn off the default background displayed for HTML cont<strong>en</strong>t, set the<br />

paintsDefaultBackground property to false. The following example creates an HTMLLoader and turns off the<br />

default background:<br />

var htmlView:HTMLLoader = new HTMLLoader();<br />

htmlView.paintsDefaultBackground = false;<br />

This example uses JavaScript to turn off the default background of an HTML window:<br />

window.htmlLoader.paintsDefaultBackground = false;<br />

If an elem<strong>en</strong>t in the HTML docum<strong>en</strong>t sets a background color, the background of that elem<strong>en</strong>t is not transpar<strong>en</strong>t.<br />

Setting a partial transpar<strong>en</strong>cy (or opacity) value is not supported. However, you can use a transpar<strong>en</strong>t PNG-format<br />

graphic as the background for a page or a page elem<strong>en</strong>t to achieve a similar visual effect.<br />

Window ownership<br />

One window can own one or more other windows. These owned windows always appear in front of the master<br />

window, are minimized and restored along with the master window, and are closed wh<strong>en</strong> the master window is closed.<br />

Window ownership cannot be transfered to another window or removed. A window can only be owned by one master<br />

window, but can own any number of other windows.<br />

You can use window ownership to make it easier to manage windows used for tool palettes and dialogs. For example,<br />

if you displayed a Save dialog in association with a docum<strong>en</strong>t window, making the docum<strong>en</strong>t window own the dialog<br />

will keep the dialog in front of the docum<strong>en</strong>t window automatically.<br />

NativeWindow.owner<br />

Last updated 6/6/2012<br />

894

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

Saved successfully!

Ooh no, something went wrong!