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

0 1<br />

2 3<br />

A square drawn with two triangles using the vertices parameter<br />

This technique becomes useful with larger triangle meshes where most points are shared by multiple triangles.<br />

All fills can be applied to triangles. The fills are applied to the resulting triangle mesh as they would to any other shape.<br />

Transforming bitmaps<br />

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

Bitmap transformations provide the illusion of perspective or "texture" on a three-dim<strong>en</strong>sional object. Specifically, you<br />

can distort a bitmap toward a vanishing point so the image appears to shrink as it moves toward the vanishing point.<br />

Or, you can use a two-dim<strong>en</strong>sional bitmap to create a surface for a three-dim<strong>en</strong>sional object, providing the illusion of<br />

texture or “wrapping” on that three-dim<strong>en</strong>sional object.<br />

A two-dim<strong>en</strong>sional surface using a vanishing point and a three-dim<strong>en</strong>sional object wrapped with a bitmap.<br />

UV mapping<br />

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

Once you start working with textures, you'll want to make use of the uvtData parameter of drawTriangles(). This<br />

parameter allows you to set up UV mapping for bitmap fills.<br />

UV mapping is a method for texturing objects. It relies on two values, a U horizontal (x) value and a V vertical (y)<br />

value. Rather than being based on pixel values, they are based on perc<strong>en</strong>tages. 0 U and 0 V is the upper-left of an image<br />

and 1 U and 1 V is the lower-right:<br />

Last updated 6/6/2012<br />

364

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

Saved successfully!

Ooh no, something went wrong!