Link to home
Create AccountLog in
Avatar of marko-expert
marko-expert

asked on

Load pictures

Hi Experts,

I hope that You will respond me ASAP.

I have a script:
--------------------------------------------------------
i=20;

while (i>0) {
    _root.mcy.data.duplicateMovieClip("DCP_" + i, i, {_x:10, _y:i*100+325});      
      i--;
      loadMovie("DCP_"+(i+1)+".jpg", "_root.mcy.DCP_"+(i+1)+".pic");
      }
--------------------------------------------------------
this script loads 20 diferent pictures into newly created movie clips.
I have 20 pictures maximum at the time but sometimes, I have just 5 or less.

I need a control which will stop the duplicating movie clip if there is no more pictures in the folder.

Thanks in advance
Marko
Avatar of sam85281
sam85281

You need to have server side language available to get the total files.

If you have php available...

Change your html do name from whatever.html to whatever.php then put this at the very top of the page:

<?php
if ($handle = opendir('audio')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") $thefiles[] = $file;
}
closedir($handle);
}
$totalFiles = sizeof($theFiles);
?>

Then in the object coding that embeds your swf add this param:
<param name="FlashVars" value="total=<?php echo($totalFiles); ?>" />

and in the <embed section add:
FlashVars="total=<?php echo($totalFiles); ?>"

Then in your actionscript:

Change i = 20; to i = total;

-Sam
Oh!  In the first line of the php:

if ($handle = opendir('audio')) {

Change audio to the directory that your images are in.

Make sure permissions on the folder are set to 777

-Sam
Avatar of marko-expert

ASKER

I do not have PHP support...
ASKER CERTIFIED SOLUTION
Avatar of sam85281
sam85281

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer