Solved

preloading thumbnails in flash with php

Posted on 2004-08-12
10
266 Views
Last Modified: 2012-05-04
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
Comment
Question by:jbadia
  • 5
  • 4
10 Comments
 
LVL 9

Expert Comment

by:dutchfoxer
ID: 11799599
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
 

Author Comment

by:jbadia
ID: 11801624
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
 
LVL 9

Expert Comment

by:dutchfoxer
ID: 11801672
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:jbadia
ID: 11801697
but what preloader i use, I dont know to make a preloader with a progressbar
0
 
LVL 9

Expert Comment

by:dutchfoxer
ID: 11801916
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
 

Author Comment

by:jbadia
ID: 11802273
if i put the progress bar of flash mx, can I use your code?
0
 
LVL 9

Expert Comment

by:dutchfoxer
ID: 11802292
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
 

Author Comment

by:jbadia
ID: 11812271
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
 
LVL 9

Accepted Solution

by:
dutchfoxer earned 500 total points
ID: 12235388
I missed the last question i see..... so dont know actually. Accept with C-grade?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to record live broadcast.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question