Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML & Flash - should be an easy fix - but can't find it.

Status
Not open for further replies.

whoknows361

Technical User
Sep 22, 2005
228
US
Hello all.
I am using xml and flash for a photo viewer. Here is my code:
Code:
stop();

var thumb_spacing = 48;


function GeneratePortfolio(portfolio_xml){
	var portfolioPictures = portfolio_xml.firstChild.childNodes;
	for (var i = 0; i < 10; i++){
		var currentPicture = portfolioPictures[i];
		
		var currentThumb_mc = menu_mc.createEmptyMovieClip("thumbnail_mc"+i,i);
		currentThumb_mc._x = i * thumb_spacing;
		
		currentThumb_mc.createEmptyMovieClip("thumb_container",0);
		currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);
		
		
		currentThumb_mc.image = currentPicture.attributes.image;
		
		currentThumb_mc.onRollOver = currentThumb_mc.onDragOver = function(){
			
		}
		currentThumb_mc.onRollOut = currentThumb_mc.onDragOut = function(){
			
		}
		currentThumb_mc.onRelease = function(){
			image_mc.loadMovie(this.image);
			}
}		
}

// xml object for xml content (defines sources for selections)
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success){
	if (success) GeneratePortfolio(this);
	else trace("Error loading XML file"); // no success?  trace error (wont be seen on web)
}

	
	
// load
portfolio_xml.load("portfolio.xml");

You see how I used " i < 10" on my for statement. this is because I want the 10 thumbnails to show on the first line.
But my xml file contains more pics. How do I ensure that the first 10 thumbnails are on the first line... and if I want to add a second line of thumbnails, lets say 10 pixels spaced below the first, - how would I do this?

Would appreciate your guidance. Also, let's say I wanted the first pic in the thumbnails to automatically show when u load the swf. how would I do this?

And lastly, if I wanted, when I clicked on a new pic, to have the currently shown pic to fade to white, and then have the newly clicked pick to fade from white to the pic, hwo would this be done? basically a transition from current pic to next pic.

I appreciate all of your help on this - thank you very much.

Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top