Graphics Reference
In-Depth Information
private var _imageNamePrefix:String = " image_ " ;//
used for naming the images
private var _pointVector:Vector. < Point > = new
Vector. < Point > (); // vector of points for the images
private var _imageURLRequest:URLRequest = new
URLRequest(); // used to load the images
public function
SimpleGallery(parent:DisplayObjectContainer,galleryPath:
String,imageArray:Array,columns:int=1,thumbScale:Number=1,
padding:Number=5) {
_galleryParent = parent;
_galleryPath = galleryPath;
_imageArray = imageArray;
_columns = columns;
_thumbScale = thumbScale;
_padding = padding;
_numberOfImages = imageArray.length;
for (var r:int = 0; r
<
_numberOfImages; r +=
columns) {
for (var c:int = 0; c < columns; c++) {
if(r+c < _numberOfImages){
createImage(c, r);
}
}
}
}
public function setPosition(xPosition:Number = 0,
yPosition:Number = 0) {
x = xPosition;
y = yPosition;
}
// START PRIVATE FUNCTIONS
private function createImage(column:int,
row:int):void {
_pointVector.push(new Point(column,
row/_columns));
_imageURLRequest.url = _galleryPath +
_imageArray[row + column];
_imageLoader = new Loader();
_imageLoader.name = _imageNamePrefix + (row +
column);
_imageLoader.addEventListener(MouseEvent.CLICK,
imageClicked, false, 0, true);
_imageLoader.contentLoaderInfo.addEventListener(Event.
COMPLETE, placeImage, false, 0, true);
Search WWH ::




Custom Search