Image preloader not working properly

alright, here’s the problem

you click the button for the first image, it loads with preloader and everything is perfect, you click the second image, it loads but no preloader is shown

i thought it was a problem with the levels but i changed each script first to an incrementing variable and then to a static number, each with their own number, but that didn’t work.

i think it might be that the old “preloader” and “container” symbols are still active but i’m not sure

here’s the code i’m using.


this.createEmptyMovieClip("preloader", 1000);
this.createEmptyMovieClip("container", 2000);

preloader.onEnterFrame = function() {
        var l = container.getBytesLoaded();
        var t = container.getBytesTotal();
        var getPercent = l/t;
        loadText = Math.round(getPercent*100)+"%";
        loadBar._width = getPercent*160.5;
        if (l>0 && l>=t) {
                container._visible = 1;
                delete loadText;
                loadBar._visible = 0;
}
}

Why do you delete loadText??? You don’t want to delete it, you want to clear it.

[AS]loadText = “”[/AS]

ok … i made that change

problem still not fied though :blush:

How do you get the loadBar to be visible again?

You make it _visible = 0 when it fully loads, but how do you make it visible again? Is that an action on the button to load the images?

shrug
i got the script from you http://www.kirupaforum.com/forums/showthread.php?s=&threadid=15472&perpage=15&pagenumber=2

oh oh … i think i put that in there so they would disappear after the load was complete.

how do i make them come back?

Yeah, but I never made the loadBar invisible, that was something you added :wink:

You set loadBar._visible = 0 when the image is done loading.

If you don’t set it back to 1 so it is visible again, you won’t see it :stuck_out_tongue:

So I am assuming that on the buttons before you load the image you also need to reset loadBar_visible back to 1.

[edit]replied at the same time…lol[/edit]

alright i took that line out and the text still disappears b/c i set it = “” and the loadbar doesn’t go away after it’s done loading … but it does work when you load another image … it just stays there

http://www.aaronsleeper.com … go to the ‘design’ section to see what i’m talking about

…edit…
replied at the same time … lol
i’ll go make those changes real quick

here’s what i have now


this.createEmptyMovieClip("preloader", 1000);
this.createEmptyMovieClip("container", 2000);

container._visible = 0;
loadBar._visible = 1;

with (container) {
        loadMovie(_root.picture);
        _x = 240;
        _y = -60;
        _xscale = 35;
        _yscale = 35;
        _visible = false;
}
preloader.onEnterFrame = function() {
        var l = container.getBytesLoaded();
        var t = container.getBytesTotal();
        var getPercent = l/t;
        loadText = Math.round(getPercent*100)+"%";
        loadBar._width = getPercent*160.5;
        if (l>0 && l>=t) {
                container._visible = 1;
                loadText = ""
                loadBar._visible = 0;

but it’s still not working (doing the same thing it was doing before i posted actually.

i probably put stuff in the wrong place =)

…edit…
i forgot to update the swf file on the server before i tested … lol
ok so now the loadbar works the way it’s supposed to on each image but the text doesn’t come back each time

I don’t see anything wrong with it man.

Try clearing your cache because your loaded images are being cached so they are probably loading so quick you can’t see the load process.

They worked perfectly fine for me.

right it works … the loadBar does it’s thing and the images load … but the numbers only show up on the first image i load … the other images have the loadbar but no percentage

text isn’t showing b/c it’s the same color as the bg … :slight_smile:

So everything all fixed now?

yep yep =)

thank you very much for the help:chinaman:

No problem, glad you got it working :slight_smile: