Game Development Reference
the Stage; you can think of it as followingtheinvisibleline
created from your eyes to the screen.
On the z -axis, the value of 0 is at Stage level. Negative values for the
z property of a DisplayObject would make the object appear larger
to the viewer. Positive values for z will increasingly shrink
the object, making it
Flash developers who have per-
formed tricks with the x and y scales of objects in the past to achieve
the feeling of depth and 3D space will no doubt breathe a sigh of relief
at the ease with which this effect can now be achieved with only a line
or two of code. It should be noted that the z position of an object only
tells Flash how to properly render the object in perspective; it does not
affect the display list order. In other words, if you had two objects in a
ssayonewitha z position of 30, whereas the other had a
z position of 10), but the one with the higher z position was added to
the Stage later, it would still appear to be on the top in the display list.
In addition to 3D positioning, you can also rotate DisplayObjects
around any of the three axes. Figures 11.10
11.12 illustrate how a
DisplayObject is rendered when its rotationX , rotationY ,and rota-
tionZ properties are each set to 45, respectively. You
ll notice that
the effect of rotationZ is not unlike the traditional rotation property
from previous versions of Flash.
At this point it
s important to understand how the 3D transformations
are computed and are applied to give the illusion of 3D space in a 2D
environment. Each DisplayObject in Flash has a vanishing point, that
is, the point in 3D space where all parallel lines heading to the point
appear to converge. The use of just one vanishing point is known as
Figure 11.10 A DisplayObject
rotated 45° on its x-axis.