View Full Version : Directory Listing
mrbirtch
01-24-2005, 03:29 PM
I am creating an animation that calls on images in a specific directory randomly. I would like to be able to add images to this directory and then automatically the flash file would read the images in that directory and choose one randomly. Is there a way that flash can read a file listing of a certain directory and then input it into an array? Any help on this would be appreciated
hangalot
01-24-2005, 03:41 PM
serverside script is needed
mrbirtch
01-24-2005, 03:52 PM
Ya, I figured as much. However this is not a web project, thus I am looking for an alternate solution. Thanks though
senocular
01-24-2005, 03:57 PM
use something like screenweaver then (or some other 3rd-party Flash player allowing for file access)
mrbirtch
01-24-2005, 04:15 PM
Sorry, that won't work either...I work on a mac currectly
CyanBlue
01-24-2005, 04:34 PM
Zinc, formerly Flash Studio Pro, has OSX plugin that you can use... :)
http://www.multidmedia.com/software/zinc/
http://www.multidmedia.com/software/zinc/osx/
mrbirtch
01-24-2005, 10:17 PM
What would be the best way to find out the number of files in a directory using action script? right now I have a naming convention in the desired directory where the prefix is always the same and then followed by a number starting at 0. for example:
texture0.jpg
texture1.jpg
texture2.jpg
...
I need to do it via actionscript because the project is not a web based project.
CyanBlue
01-24-2005, 10:22 PM
ActionScript cannot do that job... Use third party projector tools as you have been told... and please do not create multiple posts... That's called crossposting... :(
If you have sequentially named files you could do something like this:
PSEUDO CODE:
create a movieclip called foo with a movieclip called pic in it(just onEnterFrame{if(getBytesTotal() < 50) exists = false;} Set exists to true in onLoadFrame.
The reason for a if(getBytesTotal() < 50) is that if the movieclip is greater than 50 bytes, it most likely has a picture file in it. an empty movieclip takes up around 12 - 16bytes i think. so the 50 bytes is just to make sure the movie clip isn't counted.
maxFiles = 1000; //sets a limiter to stop infiniste loops
for(i = 0; i < maxFiles; i++)
{
foo.duplicateMovieClip("texture" + i);
mc = this["texture" + i].pic;
mc.loadMovie("texture" + i);
}
Then do a check in the next frame of the main timeline
for(i = 0; i < maxFiles; i++)
{
foo.duplicateMovieClip("texture" + i);
mc = this["texture" + i].pic;
if(!mc.exists)
{
totalFiles = i;
break;
}
}
um, i'm really new at actionscripting, and i understood most of that code you posted, but i'm confused as to where you got that 'mc' from. is it a variable or something?
northcode
01-30-2009, 04:58 PM
"mc" is an alias for the movieclip created by the call to duplicateMovieClip.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.