Hi Guys,
I have made a dynamic picture album with the following code:
for (var i = 0; i<=6; i++) {
var t = this.createEmptyMovieClip("thumbnail"+i, i);
var c = t.createEmptyMovieClip("picHolder", 0);
var thumb = "portfolio/pic"+i+"_t.jpg";
c.loadMovie(thumb);
t.picToLoad = "portfolio/pic"+i+".jpg";
t.tekstToLoad = "portfolio/tekst"+i+".txt";
t.onRelease = t.onReleaseOutside=function () {
this.stopDrag();
if (this.hitTest(mainPicContainer)) {
this._y = mainPicContainer._y+10;
this._x = mainPicContainer._x+10;
if (currentActivePic != undefined) {
currentActivePic.onEnterFrame = easeBack;
}
currentActivePic._visible = true;
currentActivePic = this;
mainPicContainer.loadMovie(this.picToLoad);
my_lv.load(this.tekstToLoad);
this._visible = false;
preloader._visible = true;
abc = _root.createEmptyMovieClip("temp", 1000);
abc.onEnterFrame = function() {
t = mainPicContainer.getBytesTotal();
l = mainPicContainer.getBytesLoaded();
per = Math.round((1-(l/t))*100);
percent = Math.round(l/t*100);
if (t == l && t != 0) {
preloader.percent = "";
preloader._visible = false;
delete this.onEnterFrame;
} else {
preloader.percent = percent+" % loaded";
preloader.bar._width = per*2.0;
}
};
}
}
}
[color=red]mainPicContainer.loadMovie("portfolio/pic0.jpg");[/color]
The problem I have is that the preloader isn’t working for the initial picture (code in red) because i’m calling it outside the function, but when I place it inside the function, it isn’t loading at all. What should I change in my code to make the preloader also work for the initial picture?