Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

preloading thumbnails in flash with php

Posted on 2004-08-12
10
Medium Priority
?
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1000 total points
ID: 12235388
I missed the last question i see..... so dont know actually. Accept with C-grade?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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 what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

609 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