Graphics Reference
In-Depth Information
public function get galleryPath():String{
return _galleryPath;
}
public function get imageArray():Array{
return _imageArray;
}
Sample Use of SimpleGallery
AndnowaquicksampleuseofSimpleGallery.Justlikethe
previous samples, this is a Document class that is located in the
com.flashadbook.base package. This one uses an images directory
that contains nine images named galleryImage1.jpg through
galleryImage9.jpg. You can download the directory of images from
thesamelocationasthecode,anditshouldbeplacedwithyour
.fla file (or you should alter the _galleryPath variable to match its
location). So let
'
s go through this sample real quick.
Skipping the imports and jumping right into the variables,
we have the declaration of _simpleGallery, _galleryPath, and
_imageArray (all of which are obviously described in their
names). After that is the _columns variable that I chose to do a
little math on to get the number of columns and rows to come
as close to matching as possible given the number of images in
_imageArray . Again, set that value to meet the requirements of
the project at hand. _thumbScale and _padding aresetnext,and
again, these are self-explanatory in their names. Once we step in
to the constructor, we
ll create a shiny new SimpleGallery and
pass it all the variables we just got finished setting up. The last
two steps are to set the position of the gallery and then to add it
to the stage.
'
package com.flashadbook.base {
import com.flashadbook.display.SimpleGallery;
import flash.events.MouseEvent;
import flash.display.Sprite;
public class SimpleGallerySample extends Sprite {
private var _simpleGallery:SimpleGallery;
private var _galleryPath:String =
"
images/
"
;
private var _imageArray:Array = new
Array(
"
galleryImage1.jpg
"
,
"
galleryImage2.jpg
"
,
"
galleryImage
3.jpg
"
,
"
galleryImage4.jpg
"
,
"
galleryImage5.jpg
"
,
"
galleryImage
6.jpg
"
,
"
galleryImage7.jpg
"
,
"
galleryImage8.jpg
"
,
"
galleryImage
9.jpg " )
private var _columns:int =
Math.round(Math.sqrt(_imageArray.length))
private var _thumbScale:Number = 0.15;
private var _padding:Number = 5;
Search WWH ::




Custom Search