Load pictures

Posted on 2006-04-09
Last Modified: 2010-04-03
Hi Experts,

I hope that You will respond me ASAP.

I have a script:

while (i>0) {"DCP_" + i, i, {_x:10, _y:i*100+325});      
      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
Question by:marko-expert
    LVL 16

    Expert Comment

    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:

    if ($handle = opendir('audio')) {
    while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != "..") $thefiles[] = $file;
    $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;

    LVL 16

    Expert Comment

    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


    Author Comment

    I do not have PHP support...
    LVL 16

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
    While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
    The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
    The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now