• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

preloading thumbnails in flash with php

hello, I'm making a web site with a catalog of images. That images name are in a mysql database, in a field with the path and the name of the image.
When I open the instance, I get the php data by loadvars and i get thethumbnail image via image.loadMovie(path). How can I do to make a preload of every thumbnail image. I post my code.

function ShowLinks()
{
for(a=1;a<=8;a++)
{
botonlinks.duplicateMovieClip("botonlinks" + a,a);
ct = _root.slider1.slider["botonlinks" + a];
ct._y = botonlinks._y + 0;
ct._x = -100 + a * 190;

ct.botobo.botobo2.name = eval("CargaVariables.name"+a);
ct.botobo.botobo2.descripcio = eval("CargaVariables.descripcio"+a);
ct.botobo.botobo2.path = eval("CargaVariables.path"+a);
ct.botobo.botobo2.model = eval("CargaVariables.model"+a);
ct.botobo.botobo2.foto._xscale = 100;
ct.botobo.botobo2.foto._yscale = 100;
// get a large image
ct.botobo.botobo2.foto.loadMovie(eval("CargaVariables.pathumb"+a));

}

}
CargaVariables = new LoadVars();
CargaVariables.load(_root.marques.plana + _root.marques.tipus + ".php");
CargaVariables.onLoad = ShowLinks;


stop();


Can download my .fla code in this page:
www.lasaint.com/lasa.zip

Thanks a lot.

Jordi
0
jbadia
Asked:
jbadia
  • 5
  • 4
1 Solution
 
dutchfoxerCommented:
You would need to do a loop inside your movie-timeline. With in the loop the following code:

if (ct.botobo.botobo2.foto.getBytesLoaded() == ct.botobo.botobo2.foto.getBytesTotal() & ct.botobo.botobo2.foto.getBytesTotal() > 15) {
            gotoAndPlay("inladenfoto3");
} else {
            gotoAndPlay("loopfoto2");
}

It can be done in many nicer ways, but above is the basics. You could also have the above check for ALL thumbnails at the end of the movie and work with _visible=true and false for example.

veel succes!
0
 
jbadiaAuthor Commented:
sorry, I think I don't have explained right.
I just want toy say that I want to put a preloader on every  duplicated image and a preloader with a progressbar, when it arrives to 100%, should explain the duplicated image loaded. Thanks
0
 
dutchfoxerCommented:
In the image (movieclip) that you duplicate you can use actionscript like this:

this.getBytesLoaded()  ....or....  this.foto.getBytesLoaded()   if there is another movieclip in it called foto
 and
this.getBytesTotal()

Progressbar:
loadprogress = ( this.getBytesLoaded() / this.getBytesTotal() ) * 100;
preloader.gotoAndStop(loadprogress);
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
jbadiaAuthor Commented:
but what preloader i use, I dont know to make a preloader with a progressbar
0
 
dutchfoxerCommented:
Oke, then you need a tutorial... a good one and not my chitter-chatter.

You can find some good tutorials on the next site (most have also a downloadble FLA file with it):
http://www.tutorialized.com/search.php?s=preload&id=5

And a bit more complex... BUT it is aimed at loading external JPG's:
http://www.flashguru.co.uk/000044.php

And finally you also have "plug and play" flash components, including Preloaders. BUT most of them work on the Flash-Movie level, not on MovieClip level.
http://www.flashcomponents.net  (search for preload)
0
 
jbadiaAuthor Commented:
if i put the progress bar of flash mx, can I use your code?
0
 
dutchfoxerCommented:
I think yes if I understand you correctly. But my code is just to help you on your way. It needs to be completed and fine-tuned.

Otherwise the tutorial from flashguru (see URL above) will be helpfull.
0
 
jbadiaAuthor Commented:
ok,

I have put into a frame of the movieclip that it duplicates the follow code:

function cargando() {

      var total, cargados, porcentaje;
      total = foto.getBytesTotal();
      cargados = foto.getBytesLoaded();
      porcentaje = Math.floor((cargados*100)/total);
      barra_mc.porcentaje_txt.text = "[ "+cargados+" Kb]";
      barra_mc.gotoAndStop(porcentaje);
      if (cargados == total) {
            clearInterval(hiloPrecarga);
                  stop();
            barra_mc.unloadMovie()
            
      }
}
var hiloPrecarga = setInterval(cargando, 1);
stop();

the preloader just appears in only one of the various categories of images that it have to show. Why in only one? What i'm doing bad?
0
 
dutchfoxerCommented:
I missed the last question i see..... so dont know actually. Accept with C-grade?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now