I have tried looking for this, but I cannot seem to find anything, and do not know if it is possible… I have a photo gallery that loads individual pictures into a box on the stage. I have a combobox that is used to select categories from which to view the pictures from. My problem comes from the fact that each directory the pictures are in can contain differening numbers of pictures within them, causing there to either be too many frames, leaving blank pictures, or not enough frames to load them all in… What I need is some way of looking at the directory (category) selected, counting the number of files in there, and loading that number in as a variable for use in navigation. Anyone have any suggestions on how to get started?
Thanks!
that could easily be done with any server-side scripting language such as PHP or ASP etc…
OK… but I am not sure how to do it in those either… If I did it using PHP or ASP, how would I incorporate that into my flash movie? It seems like there should be some way of doing it in flash…
First off let me start by saying that I am new to Flash, so I may be totally off base. But IMHO, I think that you are going to have to use AS to dymanicly duplicate your box on stage for the number of items that are in your directory. I am not sure if flash give you the infomation that your are going to need or if you are going to have to use ASP or PHP to read your directories for you and then pass the data into your swf. You will probably need to have a maximum number of boxes that you can display with a paganator, or something to control sliding some out and new ones in to allow for a directory with more images than the stage will fit. This is where what I know is quickly ending =) , but I would serach for duplicate movie in the forum.
-jimmy
Hi Jimmy and thanks for the reply… I am pretty new to flash as well. I do know that actionscript will have to be used in some form… It just seems like there should be some way of coding it in actionscript, although there may not be… I know that I can manually assign the number of files in each directory and have it done that way, but it just would be nice if I could do it dynamically…
In looking for a way to have an unkown number of phrases passed to my swf from a database, I ran accross this tutorial, but I can not remember where I got it to give the person credit. I have attached it so that you can see the way that he/she dynamicly duplicated a movie clip. I think that flash’s file access, meaning the ability to “browse” a disk drive is pretty much non existant. You may look into having a txt or xml files in the directories that you keep an idex of the images, which you can use to browse your pictures.
Hope that this can be of some help,
-jimmy
Can I see your fla?
Too big to upload here, but you can snag it here instead
Here is a question… I am just trying to set up the variable for the number of pictures and using that variable in the code below… For some reason it does not change from the value first assigned to it after whichdir (whichdir = data from a combo box, in this case I want the data = CCJ)
[AS]
myMaxPic = 20;
//Set the value of myMaxPic for comparison to whichPic
mymaxfunc = function() {
if (whichdir == “CCJ”) {
myMaxPic = 7;
};
}
next.onPress = function() {
if (whichPic<myMaxPic && !fadeIn && !fadeOut) {
fadeOut = true;
whichpic++;
input = whichPic;
whichCap++;
whichdir = dropdown.getSelectedItem().data;
captions.htmlText = loadText[“caption”+whichCap];
} else {
if (whichPic==myMaxPic) {
//&& !fadeIn && !fadeOut
fadeOut = true;
whichpic = 1;
whichCap = 1;
captions.htmlText = loadText[“caption”+whichCap];
input = whichPic;
} }
};[/AS]
Just in case anyone wants to know I just handled the situation by using if statements and manually input the number of photos in each category. I assigned variables for the number of pics so hopefully updating in the future will not be too bad