fscommand("allowscale", "false");
Stage.scaleMode = "noScale";
targetPhoto._visible = false;
slides_xml = new XML();
slides_xml.onLoad = loadSlideShow;
slides_xml.load("album.xml");
slides_xml.ignoreWhite = true;
function loadSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
currentSlideNode = rootNode.firstChild;
photos = new Array(totalSlides);
thumbs = new Array(totalSlides);
captions = new Array(totalSlides);
tx = 0;
for (i=0; i < totalSlides; i++) { // populate arrays and create thumbnails dynamically
photos[i] = currentSlideNode.attributes.jpegURL;
thumbs[i] = [currentSlideNode.attributes.jpegWidth,currentSlideNode.attributes.jpegHeight];
captions[i] = currentSlideNode.firstChild.nodeValue;
_root.attachMovie("thumb","thumb"+i,i);
_root["thumb"+i]._x = tx;
_root["thumb"+i]._y = 420; // using fixed Y coord
_root["thumb"+i].tindex = i;
tx += 22;
currentSlideNode = currentSlideNode.nextSibling;
}
// initialize values
currentIndex = 0;
targetWidth=thumbs[currentIndex][0]; // get width
targetHeight=thumbs[currentIndex][1]; // get height;
updateSlide();
}
}
function updateSlide() { // load photo, update caption and status fields
targetPhoto.loadPhoto(photos[currentIndex]);
caption = captions[currentIndex];
statusField = (currentIndex+1) + "/" + totalSlides;
}
function slideShow() {
if (currentIndex == totalSlides-1) { currentIndex = 0; } else { currentIndex++; }
targetPhoto._visible = false;
targetWidth=thumbs[currentIndex][0]; // get width
targetHeight=thumbs[currentIndex][1]; // get height;
updateSlide();
}
MovieClip.prototype.loadPhoto = function(fn) { // load external jpeg method + preloader
this.createEmptyMovieClip("holder", 1);
this.holder.loadMovie(fn);
this.onEnterFrame = function() {
if (Math.floor((this.holder.getBytesLoaded()/this.holder.getBytesTotal())*100) >= 100) {
delete this.onEnterFrame;
}
}
}
|