Linking dyn thumbnails to fullsize jpgs

Hey there-

I am fairly new to MX 2004, (previously used Adobe LM) but am well under way building a dynamic gallery using PHP and mySQL. So far I am able to load the thumbnails from my database, and create an onPress event for each thumbnail. I can get a static .jpg to load, but I can’t get the thumbnial to link with the corresponding fullsize image dynamically.

Basically I have loaded the filenames from the database into two arrays: thumbnails[] and fullsize[]. I know the database is working perfectly, I can load the fullsize images or the thumbnails into the thumbnail placeholders. I’m at work so I can’t post the .fla until later, but I can paste the AS into a message if anyone is willing to help.

BTW I know nothing about XML…

Any help is greatly appreciated!!

–JD

I have found some things that may help, but until I work through them all, here’s my .fla if anyone is willing to check it out. Thanks.

–J

So I am trying to pass a simple variable (currentMC.link) to each of my dynamically created MC’s. I can’t figure out how to pass “i” so as each clip is created in the loop, currentMC.link is set to “i” at that point in the loop. Why is currentMC.link only returning “5”? Can someone please check my AS?

c = new LoadVars();
c.load("test3.php");
c.onLoad = function() {
	total = this.num  //total number of pics from db
	// initialize thumbnails array
	_global.fullsize = [];
	_global.thumbnails = [];
	
	//initialize values
	picHolder._alpha = 100;

	

	for(i = 0; i < total; i++){
		currentMC=_root.thumbMover.createEmptyMovieClip("thumbButton"+i, 50+i);
		//accomodate for thumbMover's registration point (thumb's total y/2)
		currentMC._y= -30;
		//create thumbnail holders
		currentMC.createEmptyMovieClip("thumbBox"+i, 10+i);
		// set variable in each mc
		currentMC.link = i; 
		mc= currentMC["thumbBox"+i]; 
		//disperse thumbnail placeholders based on width of thumbnail
		currentMC._x = 52 + (52 * i); 
		//load php var "large" into fullsize array
		//fullsize* = this["large"+i];
		//load php var "thumb" into thumbnails array
		thumbnails* = this["thumb"+i];
		// load placeholders based on thumbnails array
		mc.loadMovie("pics/"+thumbnails*);
		//initiate change to new image when thumbnail is clicked
		currentMC.onPress = function(){
			test1 = currentMC.link;
			if (!fadeIn && !fadeOut) {
			fadeOut = true;
			
			}
		
		}
		
	}
	
}

Thanks!!

Well I finally figured it out. If anyone cares, it wasn’t working since I was using the “currentMC” var to point to the “link” var. Since the onPress events are contained within the for loop, they are getting passed on to the new emptyMovieClips. The correct function would be:

currentMC.onPress = function(){
			_root.test1 = this.link;
}

Cheers!