Solved

preloading thumbnails in flash with php

Posted on 2004-08-12
10
263 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
 

Author Comment

by:jbadia
ID: 11801697
but what preloader i use, I dont know to make a preloader with a progressbar
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now