View Full Version : xml photo gallery

04-14-2007, 09:33 AM

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

>>> so my xml file is this:

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

>>> 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() {
title_txt.text = this.title;

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

04-20-2007, 05: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() {

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.