2 Replies Latest reply on May 30, 2007 12:23 PM by halfgrokked

    Counting the files in an image folder

    Centerpoint_Computer
      I have created a target_mc that loads images based on the frame number of the timeline. loadMovie(imageFolder + imageType + _currentFrame)

      imageFolder and imageType are variables that are set on a navigation menu item roll over. _currentframe pulls the current frame number. Combined, they make up the name of the image.

      The slideshow navigation buttons (forward and back) move the playhead and the images are loaded based on the position of the framehead. Frame 1 = image01.jpg etc.

      What I want to do is create actionscript that reads a folder containing the images and counts the number of files. Then I could store that number in a variable and use some actionscripting to load the images into the target_mc.

      Any ideas? The problem I have is when a new image is added to a slideshow movie clip I have to insert a frame or when a pictures is removed I have to remove a frame from the timeline for that clip.
        • 1. Re: Counting the files in an image folder
          Level 7

          > What I want to do is create actionscript that reads a folder containing the
          > images and counts the number of files. Then I could store that number in a
          > variable and use some actionscripting to load the images into the target_mc.

          No such thing, flash has no system accessibility and it can't read folder content.
          You need to do it with some middle ware like php or asp.

          > Any ideas? The problem I have is when a new image is added to a slideshow
          > movie clip I have to insert a frame or when a pictures is removed I have to
          > remove a frame from the timeline for that clip.

          The problem is with your design. We normally don't hard code and hard built
          movies like that. Driven dynamically by XML is your best choice. It gets the
          info, makes the slide in real time based on input. All you need to do than
          is modify the xml file, not flash.
          Anyhow, here is an example of flash reading folder content using php.
          (inside the zip file you will find asp sample as well)
          http://flashfugitive.com/stuff/tree/dirtree.swf



          --
          Best Regards

          Urami


          --


          <urami>
          If you want to mail me - DO NOT LAUGH AT MY ADDRESS
          </urami>
          • 2. Re: Counting the files in an image folder
            halfgrokked
            Urami. I just ran across this post from a while back. Do you have a zip file wtih some source code? I need a way to count images in a folder for a gallery. Any help is dearly appreciated. thanks!