BIG troubles with preloader

  • esse_bi
  • Novice
  • Novice
  • esse_bi
  • Posts: 15

Post 3+ Months Ago

I'm loading with loadMovie about 20 jpgs inside my swf gallery.swf, the jpgs are inside a mc called container_mc and I can see all of them going further and back, all in the container_mc
I call from home.swf pressing a button gallery.swf
I'd like to add a preloader that loads all content before starting navigating the gallery, so all my jpgs are loade, and I see them one by one in the container_mc without wait time anymore...

I'm really unable to solve it
I've tried with getBytesTotal/loaded but it seems not to work

help!!!

thx
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Flanders
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48
  • Loc: Reno, Nevada US

Post 3+ Months Ago

When loading external content with code, the getBytesTotal does not accurately reflect the true size of the movie when all content is loaded. If you have a swf file that is 10kb with code in it that loads 20 images, the file is still only 10kb while loading. To get something like this to work, you have to write some code that won't execute your movie until the last image is loaded in.

Code: [ Select ]
 
var i = 0;
var num = number of images to load;
 
loadimages(i,num);
 
function loadimages(i,num){
if(i!=num){
//load your image here
i++;  //increment your counter
loadimages(i,num);   //call the function again
 
}else{    //You have already loaded the last image
 
//start your movie here
}
 
  1.  
  2. var i = 0;
  3. var num = number of images to load;
  4.  
  5. loadimages(i,num);
  6.  
  7. function loadimages(i,num){
  8. if(i!=num){
  9. //load your image here
  10. i++;  //increment your counter
  11. loadimages(i,num);   //call the function again
  12.  
  13. }else{    //You have already loaded the last image
  14.  
  15. //start your movie here
  16. }
  17.  
  • esse_bi
  • Novice
  • Novice
  • esse_bi
  • Posts: 15

Post 3+ Months Ago

Thx a lot, for your answer, I'm really getting crazy!
I mean, I've finished my site, then I say ok, I make preloaders and it's complete! But I cannot make preloaders :,-(
When you write //load your image here// where have I got to load it?
I have to put all of them in a place where they are not visible, but that I can call in my stage with buttons I've already made:
I have a clip named large and clips that load within large the jpgs
with loadMovie(i+".jpg", "large") so I will have to change this action because otherwise it starts loading again the jpgs, with another that moves the jpg I need frome the place where I've stored them to my clip large...
is it possible?
thx you very very very very much!!!
  • Flanders
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48
  • Loc: Reno, Nevada US

Post 3+ Months Ago

The 'load images here' can be a whole block of code.
you could load the image and move it to a location off the stage change it's alpha or any other transformations. Then, once the last one is ready and loaded, you can take all of them and place them wherever back on the stage in the 'start your movie here' code block. The very last thing to execute would be the gotoAndPlay() statement that starts up the movie after you have finished everything else (loading and placement of all movies).
  • esse_bi
  • Novice
  • Novice
  • esse_bi
  • Posts: 15

Post 3+ Months Ago

I've tried with the following code, but I cannot make invisible my jpgs, and when I simulate upload It loads two jpgs, plays the root, starts again with loading the first two jpgs, palys the root....

Where am I mistaking???
thx

stop();

bar._visible = false;
border._visible = false;


for(z=1;z<=10;z++){
mymovieclip="container"+z
createEmptyMovieClip(mymovieclip, z);
mymovieclip._visible = false;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {mycontainer._visible=false
trace(mycontainer+"container")
bar._visible = true;
border._visible = true;
pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
pText.text = "% "+Math.round((lBytes/tBytes)*100);
};
preload.onLoadComplete = function(targetMC) {

border._visible = false;
bar._visible = false;
pText._visible = false;
play();

};

myclip="phil/fashion/big/"+ z+".jpg"
my_mc.loadClip(myclip, "container"+z);


}
  • Flanders
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48
  • Loc: Reno, Nevada US

Post 3+ Months Ago

Can you post your file somewhere?

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.