The new AS3 3D methods available in Flash Player 10 and Flash CS4 make it possible to literally 'build' 3D objects contaning many other display objects as children. Such 3D objects can then be easily rotated in 3D using the rotationX, rotationY, and rotationZ properties. In this tutorial we easily build a 3D gallery of photos on a cylinder:
- Download the files corresponding to the gallery: spacegallery.zip
In the package, you will find the space_gallery.fla file. All the simple and rather short code necessary to create the gallery is attached to the first frame of the Timeline for maximum simplicity. The code is very well-commented with instructions for customization.
In essence we 'build' a 3D cylinder by creating Sprites that are its sides (and children). We then position those Sprites in the 3D space to form a 3D cylinder. Photos are children of the sides. The whole thing becomes one 3D object. We then rotate the object using the rotationY property with a 'dash' of tween. The only part that requires minimal use of the Matrix3D class is sorting of the faces for each view of the cylinder.
Note that in our Flash Player 10 tutorial: 'Interactive, Open-Sided Bitmap Cube in Flash Player 10' we used a very similar technique to 'build' and rotate a cube of images. (In the latter tutorial, use Beta 2 versions. They work with the release version of FP10.)
The stunning images of the outer space that you see in the gallery are courtesy of NASA: NASA multimedia collection.