Friday, 22 April 2011

3D view controller in Flash using ActionScript 3

The three-dimensional capabilities of Adobe Flash CS4 Professional allow changes in the zoom and view perspective, and its handling of 3D math makes it easier to navigate in and around a 3D scene. Game developers and animators can now incorporate 3D view and movement more easily than before.
This tutorial explores two different ways to change what is shown on the Stage
  • Changing the viewpoint through pan and zoom
  • Moving the objects themselves within the 3D space
Moving the viewpoint is simple and acts like a camera zoom lens. Moving objects on the Stage using the object's x,y, and, z attributes is not much more difficult and offers full movement on each axis—it's like holding an object in your hands with the ability to move it in and out, up and down, and also allows rotations of the scene itself.
The code in this tutorial demonstrates both methods, including how to perform multiple transformations using the Matrix3D class. The sample files contain navigational UI controls for changing the view using both approaches, as shown in Figure 1.

3D Movie Flash Photoshop