Solved

preloading thumbnails in flash with php

Posted on 2004-08-12
10
265 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flash media server 1 332
Error 2032 in all the browser 6 2,837
Adobe Media Server Or Encoder Broken Affer Static IP Change 4 168
Web browser crash when play videos 24 284
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to record live broadcast.

770 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