The SpinnerMenu class uses the new 3D rotation properties available in Flash Player 10. The class can easily be adapted to create any kind of spinning 3D menu.
The SpinnerMenu class has the following public methods.
The constructor evoked with the key word 'new':
- new SpinnerMenu(thumbs:Vector.<Bitmap>,pics:Vector.<String>,n:int,sp:int=2,px:Number=10)
The parameter 'thumbs' is a Vector of Bitmaps corresponding to thumbnails. The second parameter, 'pics', is a Vector of Strings that contains addresses of images to be loaded as the user clicks on thumbnails. 'n' is an integer that dictates the number of tiles displayed at one time in the vertical menu. The last two parameters are optional. 'sp' gives the speed of rotation and has only three possible values: 1, 2, 3. 'px' gives the distance, in pixels, between tiles in the vertical column.
For the menu to function properly, 'thumbs' and 'pics' have to have the same number of elements, say 'elems'. Furthermore, 'n' has to be a factor of this number; that is, 'elems' must be divisible by 'n' without a remainder. Also, 'n' cannot equal 'elems'. For example, if you use 30 images, then 'n', the number of items in a column, can be equal to 1, 2, 3, 5, 6, 10, and 15. If you choose '1', you will have one spinning tile with 30 different images appearing on the reverse as the tile spins. If you choose '15', you will have 15 tiles with only two different images appearing as the menu spins.
- doSpin(s:String):void
The parameter 's' is responsible for the direction of the spin. It can have two values "left" and "right". In our, example the direction is chosen randomly with each click on the arrow button.
- loadInitial():void
The method, if called, will load the first image on the list without the user's click.
The SpinnerMenu class has the following public properties. The fisrt three are DisplayObjects corresponding to the three elements of each instance: the spinning menu which is a Sprite, a Loader object into which large images are loaded, and an info TextField displaying messages about loading. Those three elements are public, so they can be easily manipulated and positioned for your instance of SpinnerMenu.
- menuSpinner:Sprite
- menuLoader:Loader
- menuInfoBox:TextField
See the file spingallery.fla in the package for examples on how to use those properties.
The last two public properties represent the width and the height of the spinning column of tiles:
- menuWidth:Number
- menuHeight:Number
Again, see the file spingallery.fla in the package for examples on how to use those properties.
Download
- Download the files corresponding to the gallery: spingallery.zip
In the package, you will find all the source code and image files used in this effect.











