Flash Gallery

Page 1 of 1

0 Replies - 709 Views - Last Post: 14 July 2008 - 10:05 PM

#1 infinite.ever  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-July 08

Flash Gallery

Post icon  Posted 14 July 2008 - 10:05 PM

Hi all!

I'm doing a flash gallery for a personal site of mine.

What I'm stuck with is the viewing of the thumbnails. Due to the lack of physical space, I would want to view the image over the thumbnails, possibly click the image to close it so users can view other thumbnails.

What I'm concerned about is the scaling effect from the image which I do not know how to apply it to my XML.

These are my xml codes
stop();
//Create new xml and load the particular xml file
myxml = new XML();
myxml.ignoreWhite = true;
myxml.load("photos.xml");

//Create new function
myxml.onload = function(success) {
	//Create new variables
	numImages = this.firstChild.childNodes.length;
	var spacing:Number = 75;
	var rowSpacing:Number = 0;
	var i:Number = 0;

	//Create a While loop which will only ends when there is no more images
	while (i < numImages) {
		//Create a For loop which allows to load the images at different y position
		for(var j:Number = 0; j < 4; j++) {
			//Create a If statement to load the images
			if (i < numImages) {
				
				//Assign values for the movie clips
				this.picHolder = this.firstChild.childNodes[i];
				this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
				this.thumbHolder._x = j*spacing;
				this.thumbHolder._y = rowSpacing;
				this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
				this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
				this.thumbHolder.main = this.picHolder.attributes.main;
				//This allows the thumbnails to be clickable and load the main images and captions on the movie clip - loader 
				this.thumbHolder.onRelease = function() {
					loader.loadMovie(this.main);
				};//End of thumbHolder.onRelease function
			}//End of If loop
			i++;
		}//End of For loop
		//Change the value of rowSpacing
		rowSpacing += 70;
	}//End of While loop
}




and I got the following codes from one of the threads here but I don't know how to put it in my codings.
// set the thumbnail size and scale amount (1 = 100% = no scale)
var thumbWidth:Number = 100;
var thumbHeight:Number = 80;
var scaleFactor:Number = 1;

// determine the amount of scaling required
if(imageToShrink._width > thumbWidth) { scaleFactor = thumbWidth / imageToShrink._width; }
if(imageToShrink._height * scaleFactor > thumbHeight) { scaleFactor = thumbHeight / imageToShrink._height; }

// scale the image
imageToShrink._width *= scaleFactor;
imageToShrink._height *= scaleFactor;


Please do help me! I'm very new at this.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1