PDA

View Full Version : xml photo gallery



choodeepupp
04-14-2007, 08:33 AM
hello!!

i m trying to create a photo gallery that load external pics using xml.

>>> so my xml file is this:

<gallery>
<image title="title1 here" main="images/pic1.jpg" thmb="thumbnails/pic1thumb.jpg" />
<image title="title2 here" main="images/pic2.jpg" thmb="thumbnails/pic2thumb.jpg" />
</gallery>

>>> my actionscript is this:

myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
//portfolioTag = this.firstChild;
numimages = this.firstChild.childNodes.length;
spacing = 50;
for (i=0; i<numimages; i++) {
this.picHolder = this.firstChild.childNodes[i];
this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
this.thumbHolder._y = i*spacing;
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_i mage", 0);
this.thumbLoader.loadMovie(this.picHolder.attribut es.thmb);
this.thumbHolder.title = this.picHolder.attributes.title;
this.thumbHolder.main = this.picHolder.attributes.main;
this.thumbHolder.onRelease = function() {
loader.loadMovie(this.main);
title_txt.text = this.title;
};
}
};
myPhoto.load("xmlphoto.xml");

and it s working fine! BUT:
my goal is that when u rollover the thumbnail another thumbnail loads in the same place!!! can i do that and how!?!!

thanks for your help

Medyman
04-20-2007, 04:11 PM
I'm not very good with XML but in plain actionscript if you wanted that to happen the code would look something like this.

please edit the MC names to your flash project



Thumbnail.onRollOver = function() {
unloadMovie(PictureLoader)
this.loadMovie("image2.jpg")
}

The XML cal command would appear where I've added image2.jpg but you should get the idea. it's just a matter of using the loadMovie and unloadMovie.