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
marko-expertAsked:
Who is Participating?
 
sam85281Commented:
Do you have any server side language available?  VB.NET?  Etc?

The server needs to "tell" flash how many files there are.  Flash can't do that on it's own.

-Sam
0
 
sam85281Commented:
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
0
 
sam85281Commented:
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
0
 
marko-expertAuthor Commented:
I do not have PHP support...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.