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 />

Scripting the AIR HTML Container<br />

Property Notes<br />

x, y Positions the object within its par<strong>en</strong>t container.<br />

width, height Changes the dim<strong>en</strong>sions of the display area.<br />

visible Controls the visibility of the object and any cont<strong>en</strong>t it contains.<br />

Outside an HTML window, the width and height properties of an HTMLLoader object default to 0. You must set the<br />

width and height before the loaded HTML cont<strong>en</strong>t can be se<strong>en</strong>. HTML cont<strong>en</strong>t is drawn to the HTMLLoader size, laid<br />

out according to the HTML and CSS properties in the cont<strong>en</strong>t. Changing the HTMLLoader size reflows the cont<strong>en</strong>t.<br />

Wh<strong>en</strong> loading cont<strong>en</strong>t into a new HTMLLoader object (with width still set to 0), it can be tempting to set the display<br />

width and height of the HTMLLoader using the cont<strong>en</strong>tWidth and cont<strong>en</strong>tHeight properties. This technique<br />

works for pages that have a reasonable minimum width wh<strong>en</strong> laid out according the HTML and CSS flow rules.<br />

However, some pages flow into a long and narrow layout in the abs<strong>en</strong>ce of a reasonable width provided by the<br />

HTMLLoader.<br />

Note: Wh<strong>en</strong> you change the width and height of an HTMLLoader object, the scaleX and scaleY values do not change, as<br />

would happ<strong>en</strong> with most other types of display objects.<br />

Transpar<strong>en</strong>cy of HTMLLoader cont<strong>en</strong>t<br />

Adobe AIR 1.0 and later<br />

The paintsDefaultBackground property of an HTMLLoader object, which is true by default, determines whether<br />

the HTMLLoader object draws an opaque background. Wh<strong>en</strong> paintsDefaultBackground is false, the background<br />

is clear. The display object container or other display objects below the HTMLLoader object are visible behind the<br />

foreground elem<strong>en</strong>ts of the HTML cont<strong>en</strong>t.<br />

If the body elem<strong>en</strong>t or any other elem<strong>en</strong>t of the HTML docum<strong>en</strong>t specifies a background color (using<br />

style="background-color:gray", for example), th<strong>en</strong> the background of that portion of the HTML is opaque and<br />

r<strong>en</strong>dered with the specified background color. If you set the opaqueBackground property of the HTMLLoader object,<br />

and paintsDefaultBackground is false, th<strong>en</strong> the color set for the opaqueBackground is visible.<br />

Note: You can use a transpar<strong>en</strong>t, PNG-format graphic to provide an alpha-bl<strong>en</strong>ded background for an elem<strong>en</strong>t in an<br />

HTML docum<strong>en</strong>t. Setting the opacity style of an HTML elem<strong>en</strong>t is not supported.<br />

Scaling HTMLLoader cont<strong>en</strong>t<br />

Adobe AIR 1.0 and later<br />

Avoid scaling an HTMLLoader object beyond a scale factor of 1.0. Text in HTMLLoader cont<strong>en</strong>t is r<strong>en</strong>dered at a<br />

specific resolution and appears pixelated if the HTMLLoader object is scaled up. To prev<strong>en</strong>t the HTMLLoader, as well<br />

as its cont<strong>en</strong>ts, from scaling wh<strong>en</strong> a window is resized, set the scaleMode property of the Stage to<br />

StageScaleMode.NO_SCALE.<br />

Considerations wh<strong>en</strong> loading SWF or PDF cont<strong>en</strong>t in an HTML page<br />

Adobe AIR 1.0 and later<br />

SWF and PDF cont<strong>en</strong>t loaded into in an HTMLLoader object disappears in the following conditions:<br />

If you scale the HTMLLoader object to a factor other that 1.0.<br />

Last updated 6/6/2012<br />

1001

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

Saved successfully!

Ooh no, something went wrong!