;

PDA

Click to See Complete Forum and Search --> : Loading content of a local folder


Ameretat
07-09-2007, 08:39 AM
Hi

I'm developing yet another Flash appliction and this time it's going to run localy as well as web. The problem here is that at one stage the user photos will be loaded onto the stage and I want this to load from a folder on local hard drive but I can't seem to find anyone, as PHP is a server side script I dont think i can use it.


Any help is appreciated

thanks

Ameretat

cancerinform
07-09-2007, 09:47 AM
Just create a folder on your harddrive and place the images in there and use: movieclip.loadMovie("nameoffolder/image.jpg");

Ameretat
07-09-2007, 10:00 AM
thanks for the reply, i do know that, but my problem is that, I dont know whats going to be inside the folder the user will put their photos in there for use inside the application so I need to load them in, but I have no information whatsoever about the image files.

Ameretat

cancerinform
07-09-2007, 10:19 AM
You need to know the path and name of the files.

Ameretat
07-09-2007, 10:32 AM
so you mean there is no way for flash to read the content of a folder on the local harddrive?? :(

so what would you suggest, is there anyway to show a load file dialogue box to load files from local drive, to use in the application? I've already done this but for use on the web and uploading to the web using PHP.


thanks for the help

Ameretat

cancerinform
07-09-2007, 10:44 AM
Flash would not know any names unless you feed them. The only way to know is if the user opens the folder and clicks on the file to show, but then you need to add the folder name separately (look for filereference in the help files).

Ameretat
07-09-2007, 10:54 AM
ya, thats what i was just trying, thanks for your help anyway, Flash needs to introduce more functionality with local drives!

I'll post the solution if I get to work for others to use here :)


thanks

Ameretat

swak
07-09-2007, 10:59 AM
I know that php can scan the folder for files:
<?php
$a=opendir(".");
while($b=readdir($a))if(strpos($b,".")!==0)if(strpos($b,".swf")!=false)if($b!="arrayCollect.swf")echo $b."\n";
closedir($a);
?>
I got this script earlier when I was trying to do something like what you are doing. I got this from a way earlier post of mine and someone gave me this script.

I think that this is the actionscript that I got to go with it.
for (var i in d=c.split(",")) {
var e = this.createEmptyMovieClip(d[i], i);
e.createTextField(0, 0, 20, i*20, 200, 20);
e[0].variable = "_name";
e.onPress = function() {
this.createEmptyMovieClip(0, 0).loadMovie(this._name);
};
}
Enjoy.

Ameretat
07-10-2007, 05:49 AM
thanks swak

but as far as i know PHP is a server side script so it needs to be run on the server for it to function, but in my situation everything is local, so wont be able to run PHP code.


Ameretat

swak
07-10-2007, 11:35 AM
Then you have two options. Either look at the program zinc. Zinc compiles swfs into actual programs so that you can save. A simple solution is having a text file that has a list of the things you want loaded.

Ameretat
07-10-2007, 11:42 AM
thanks, yes i have seen that program, but for this project i just took a different approach, which is fine so far, have to see what other say.

i just created a a folder called User and all the pictures are inside there, and in the instruction I ask the users to copy their image files over to this folder then load the ones they want from there!

thanks again

Ameretat

swak
07-10-2007, 11:57 AM
How do you load it then?

Ameretat
07-11-2007, 06:28 AM
using the FileReferenceList to open the browse box and they select the images, but it has to be from that folder otherwise, obviously, it won't load up. also im using the loadClip(); than the loadMovie(); function so that I can catch errors if they select a file outside of that folder.


Ameretat

swak
07-11-2007, 10:50 AM
I was thinking of trying the fileReferenceList as well to do the same kind of thing. Good job taking the initiative. I didn't think of fileReferenceList because I need to experiment with it.