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

Working with AIR native windows<br />

}<br />

};<br />

}<br />

if( this.shape.x + this.radius > window.nativeWindow.stage.stageWidth){<br />

this.vX = -this.vX;<br />

}<br />

if( this.shape.y + this.radius > window.nativeWindow.stage.stageHeight){<br />

this.vY = -this.vY;<br />

}<br />

function init(){<br />

//turn off the default HTML background<br />

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

var bottom = new Bouncer(60,0xff2233);<br />

var top = new Bouncer(30,0x2441ff);<br />

//list<strong>en</strong> for the <strong>en</strong>terFrame ev<strong>en</strong>t<br />

window.htmlLoader.addEv<strong>en</strong>tList<strong>en</strong>er("<strong>en</strong>terFrame",function(evt){<br />

bottom.update();<br />

top.update();<br />

});<br />

//add the bouncing shapes to the window stage<br />

window.nativeWindow.stage.addChildAt(bottom.shape,0);<br />

window.nativeWindow.stage.addChild(top.shape);<br />

}<br />

<br />

<br />

de Finibus Bonorum et Malorum<br />

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium<br />

doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inv<strong>en</strong>tore veritatis<br />

et quasi architecto beatae vitae dicta sunt explicabo.<br />

This paragraph has a background color.<br />

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis<br />

praes<strong>en</strong>tium voluptatum del<strong>en</strong>iti atque corrupti quos dolores et quas molestias<br />

excepturi sint occaecati cupiditate non provid<strong>en</strong>t, similique sunt in culpa qui<br />

officia deserunt mollitia animi, id est laborum et dolorum fuga.<br />

<br />

<br />

This example provides a rudim<strong>en</strong>tary introduction to some advanced techniques that cross over the boundaries<br />

betwe<strong>en</strong> JavaScript and ActionScript in AIR. If your are unfamiliar with using ActionScript display objects, refer to<br />

“Display programming” on page 151 in the ActionScript 3.0 Developer’s <strong>Guide</strong>.<br />

Example: Creating a native window<br />

Adobe AIR 1.0 and later<br />

The following example illustrates how to create a native window:<br />

Last updated 6/6/2012<br />

904

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

Saved successfully!

Ooh no, something went wrong!