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 in three dim<strong>en</strong>sions (3D)<br />

The next figure shows what happ<strong>en</strong>s wh<strong>en</strong> you set the rotationX property of the container for the squares. This<br />

rotates the squares on the x- axis.<br />

The next figure shows what happ<strong>en</strong>s wh<strong>en</strong> you increm<strong>en</strong>t the rotationZ property of the container of the squares.This<br />

rotates the squares on the z-axis.<br />

A display object can simultaneously move and rotate in 3D space.<br />

Projecting 3D objects onto a 2D view<br />

Flash Player 10 and later, Adobe AIR 1.5 and later<br />

The PerspectiveProjection class in the flash.geom package provides a simple way of applying rudim<strong>en</strong>tary<br />

perspective wh<strong>en</strong> moving display objects through 3D space.<br />

If you do not explicitly create a perspective projection for your 3D space, the 3D <strong>en</strong>gine uses a default<br />

PerspectiveProjection object that exists on the root and is propagated to all its childr<strong>en</strong>.<br />

The three properties that define how a PerspectiveProjection object displays 3D space are:<br />

fieldOfView<br />

projectionC<strong>en</strong>ter<br />

focalL<strong>en</strong>gth<br />

Modifying the value of the fieldOfView automatically modifies the value of the focalL<strong>en</strong>gth and vice-versa, since<br />

they are interdep<strong>en</strong>d<strong>en</strong>t.<br />

The formula used to calculate the focalL<strong>en</strong>gth giv<strong>en</strong> the fieldOfView value is:<br />

focalL<strong>en</strong>gth = stageWidth/2 * (cos(fieldOfView/2) / sin(fieldOfView/2)<br />

Typically you would modify the fieldOfView property explicitly.<br />

Field of view<br />

Flash Player 10 and later, Adobe AIR 1.5 and later<br />

By manipulating the fieldOfView property of the PerspectiveProjection class, you can make a 3D display object<br />

approaching the viewer appear larger and an object receding from the viewer appear smaller.<br />

Last updated 6/6/2012<br />

355

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

Saved successfully!

Ooh no, something went wrong!