Groups | Blog | Home
all groups > flash data integration > december 2005 >

flash data integration : Loading images dynamically


LuckysCharms2000
12/14/2005 7:09:31 PM
I have a slideshow that I am working on and the way the slideshow works is that
it assigns any number of images i define to an array.

problem is, i dont know how to check how many images are in a particular
folder on the hard drive. the number of images being displayed could be
anywhere from 1-200. "numofImages" is the variable that I am going to use to
cap off the looping statement... how do I tell flash to: "look in this folder
on the hard drive", "read how many elements are in the folder", "record that
number in 'numofImages' "?

I have some of my relavent code here:

//NUMBER VARIABLE FOR ARRAY
var N:Number;
//NUMBER VARIABLE FOR THE NEXT IMAGE LOADED FROM THE ARRAY
var nxtImage:Number = 0;

/*FOR STATEMENT... IF N IS LESS THAN numofImages ADD TO IT
AND THEN REPEAT THE STATEMENT IMG_ARY[N]
RESET THE IMG_VAR VARIABLE AND PRINT IT*/
for (N=0;N<numofImages;N++) {
img_var = "image"+N+".jpg";
img_ary[N] = img_var;
}
Motion Maker
12/15/2005 12:29:26 AM
Flash cannot look into server folders.

You need a server side script that will determine the number of files and
send that count back to Flash.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
I have a slideshow that I am working on and the way the slideshow works is
that
it assigns any number of images i define to an array.

problem is, i dont know how to check how many images are in a particular
folder on the hard drive. the number of images being displayed could be
anywhere from 1-200. "numofImages" is the variable that I am going to use
to
cap off the looping statement... how do I tell flash to: "look in this
folder
on the hard drive", "read how many elements are in the folder", "record that
number in 'numofImages' "?

I have some of my relavent code here:

//NUMBER VARIABLE FOR ARRAY
var N:Number;
//NUMBER VARIABLE FOR THE NEXT IMAGE LOADED FROM THE ARRAY
var nxtImage:Number = 0;

/*FOR STATEMENT... IF N IS LESS THAN numofImages ADD TO IT
AND THEN REPEAT THE STATEMENT IMG_ARY[N]
RESET THE IMG_VAR VARIABLE AND PRINT IT*/
for (N=0;N<numofImages;N++) {
img_var = "image"+N+".jpg";
img_ary[N] = img_var;
}

danredman
12/15/2005 1:14:36 PM
there are solutions...
if the flash can't read how many images are in that folder, U can help him...

if in the folder is images named image#.jpg where # is the number, and there
are no missing numbers U can stop where the image is no more loading in a movie
clip in at most 3s (timeout)
kind of:
loadmovie("image"+index+".jpg",q);
wait 3s (can do a loop for 3*fps or make frames for 3s)
if(q.getBytesLoaded<1){//there are no more files}

or U can put a .txt file with the N=#, and load it into fla, so U don't have
to change the fla just edit the .txt file when number of images
zensoldier
12/15/2005 10:48:53 PM
IF you can process asp then its easy to get the count.

dim totalFiles
Set imgDirectory=Server.CreateObject("Scripting.FileSystemObject")
Set imageFiles=imgDirectory.GetFolder(Server.MapPath"/images/"))

For each filefound in imageFiles.files
totalFiles = totalFiles + 1
next
LuckysCharms2000
12/19/2005 4:00:06 PM
AddThis Social Bookmark Button