I have a couple of jpg’s loaded dynamicly, everthing works local. But when i put this online the movie is already playing while the jpg’s aren’t loaded yet.
So i need to make sure all jpg’s has been loaded before the movie plays (it’s a movie that uses the jpg’s as a mask and background )
but what i have found is that the jpg preloader is shown when a button is pressed or something like that.
Want i want is to use the preloader i have for my main movie. During this preload-scene all the dynamic jpg’s must have been loaded. I have to make sure everything is loaded before starting the movie. In another words i don’t want to display a preloader for each jpg.
So i was thinking to use the first frame in the main movie and make AS that loads the jpg’s, something like:
But just the first jpg is shown (so just this one is loaded i think),
so i need to make sure everything is loaded before continuing.
I saw your code snippet and i want to adjust it a little bit,
for (i=1; i<5; i++) {
bg.onEnterFrame=function(){
var l="bg_ph" + i.getBytesLoaded();
var t="bg_ph" +i.getBytesTotal();
if (l > 0 && l >= t){
"bg_ph" +i._visible=1;
delete this.onEnterFrame;
}
else {
// stuff with your loading bar
//i don't want to use this part or i dn't think i need to use this part
}
}
Does this make any sense??
Code is not valid, these one is but doesn’t do the job.
for (i=1; i<5; i++) {
bigMov.bg.onEnterFrame=function(){
var l=["bg_ph"+ i].getBytesLoaded();
var t=["bg_ph" +i].getBytesTotal();
if (l > 0 && l >= t){
["bg_ph" +i]._visible=1;
delete this.onEnterFrame;
}
else {
// stuff with your loading bar
//i don't want to use this part or i dn't think i need to use this part
}
}
}
for (i=1; i<5; i++) {
//now load each jpg into a container nested in bigMov as mask and as bg
bigMov.bg["bg_ph"+i].loadMovie (pathToPics + pArray[3]);
bigMov.bg["bg_ph"+i].loadMovie ( pathToPics + pArray[0]);
bigMov.bg["bg_ph"+i].loadMovie ( pathToPics + pArray[1]);
bigMov.bg["bg_ph"+i].loadMovie ( pathToPics + pArray[2]);
bigMov.bg.onEnterFrame=function(){
var l=["bg_ph"+ i].getBytesLoaded();
var t=["bg_ph" +i].getBytesTotal();
if (l > 0 && l >= t){
["bg_ph" +i]._visible=1;
delete this.onEnterFrame;
}
else {
// stuff with your loading bar
//i don't want to use this part or i dn't think i need to use this part
}
}
}
The problem with your previous codes is that you’re overwritting the onEnterFrame each time you get into the loop so you end up preloading the last frame only.
You could set up a loading in chain. I think I posted something (completely bugged) one day, I’ll try and find it…