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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
marko-expertAuthor Commented:
I do not have PHP support...
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.