Example—creating a carousel
We've learned about quite a few material types in this chapter. Let's wrap up this knowledge and make an interactive carousel of planes that randomly use a color-based material, a bitmap file material, or a movie material. Each time the user hovers a plane with a color-based material, the material will change to a new random-colored material. The bitmap file material will randomly load one of the available images. And the movie material contains a button, which will flip the image on click.
The code for creating a carousel is based on the sphere of spheres example in Chapter 3. Although this time we will base it on a cylinder, and the 3D objects are planes.
This example uses quite a few different object types, which means that we have to import a list of 18 different classes at the top of our class:
import flash.display.DisplayObject; import flash.display.Loader; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import...