Question : Need individual preloaders to display for dynamically loading images

You have to click on this link to see what I'm talking about -  http://www.icedinteractive.com/portfolio/flyers/gallery_flyers.php  - Everything is generated dynamically. The thumbnails at the bottom generate upon page load and the images load when you click on their respective thumbnails, but none of the images reside in any movie. They sit as independent jpgs outside of any movie but in the same folder as the movie. Everything is fine with the way they load except I want a preloader to display the percent loaded for each individual image as it loads. I posted the actionscript for the movie, it's all in the first frame, the part to be concerned with though would be 'I think' the last function. I've also posted the fla file in case you'd like to view it -  http://www.icedinteractive.com/imgshow_flyers.fla  
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
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;
           }
        }
}
Open in New Window Select All

Answer : Need individual preloaders to display for dynamically loading images

Hahahaa - we blue types :-P


Random Solutions  
 
programming4us programming4us