|
Flash CS4 Resources |
Understanding the 3D features of Flash Player and the AIR runtimeIn Flash Player versions prior to Flash Player 10 and Adobe AIR versions prior to Adobe AIR 1.5, display objects have two properties, x and y , for positioning them on a 2D plane. Starting with Flash Player 10 and Adobe AIR 1.5, every ActionScript display object has a z property that lets you position it along the z-axis, which is generally used to indicate depth or distance. Flash Player 10 and Adobe AIR 1.5 introduce support for 3D effects. However, display objects are inherently flat. Each display object, such as a MovieClip object or a Sprite object, ultimately renders itself in two dimensions, on a single plane. The 3D features let you place, move, rotate, and otherwise transform these planar objects in all three dimensions. They also let you manage 3D points and convert them to 2D x, y coordinates, so you can project 3D objects onto a 2D view. You can simulate many kinds of 3D experiences using these features. The 3D coordinate system used by ActionScript differs from other systems. When you use 2D coordinates in ActionScript, the value of x increases as you move to the right along the x-axis, and the value of y increases as you move down along the y-axis. The 3D coordinate system retains those conventions and adds a z-axis whose value increases as you move away from the viewpoint. ![]() The positive directions of the x, y, and z axes in the ActionScript
3D coordinate system.
Note: Be aware that Flash Player and AIR always represent 3D in
layers. This means that if object A is in front of object B on the
display list, Flash Player or AIR always renders A in front of B
regardless of the z-axis values of the two objects. To resolve this conflict
between the display list order and the z-axis order, use the
transform.getRelativeMatrix3D()
method to save and then re-order the layers of 3D display
objects. For more information, see Using Matrix3D objects for reordering display.
The following ActionScript classes support the new 3D-related features:
There are two different approaches to simulating 3D images in ActionScript:
|