?
Solved

Load pictures

Posted on 2006-04-09
6
Medium Priority
?
171 Views
Last Modified: 2010-04-03
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
0
Comment
Question by:marko-expert
  • 3
4 Comments
 
LVL 16

Expert Comment

by:sam85281
ID: 16412147
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
 
LVL 16

Expert Comment

by:sam85281
ID: 16412149
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
 

Author Comment

by:marko-expert
ID: 16412315
I do not have PHP support...
0
 
LVL 16

Accepted Solution

by:
sam85281 earned 560 total points
ID: 16412361
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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 how to load their YouTube profile onto Flash Media Live Encoder.
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.
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

840 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