PDA

View Full Version : Is there a way I can list and rename files in folder using only flash whit AIR or ZIN


gazuraz
06-15-2010, 07:38 PM
This afternoon I got an interesting project order from my employer... Now, there is some fancy party going on and there will be a lot of photographers attending. All of the photographers shall have a wireless connection between their cams and laptop. Once some of the photographers take a shot, that picture will be automatically sent to predefined folder on laptop. That part of the job is already done. My end of work will be to create a flash application (zinc or air) that will show newest photo on some huge display behind the DJ. Normally for this kind a thing I would install WAPM server and use php directory listing, print that list it in XML and then read it in flash. Bath when I suggested that solution, my employer was not satisfied... They are in need of practically "plug and play" solution... So my question Is there a way I can list and rename files in folder using only flash whit AIR or ZINC ?

gazuraz
06-15-2010, 08:28 PM
This afternoon I got an interesting project order from my employer... Now, there is some fancy party going on and there will be a lot of photographers attending. All of the photographers shall have a wireless connection between their cams and laptop. Once some of the photographers take a shot, that picture will be automatically sent to predefined folder on laptop. That part of the job is already done. My end of work will be to create a flash application (zinc or air) that will show newest photo on some huge display behind the DJ. Normally for this kind a thing I would install WAPM server and use php directory listing, print that list it in XML and then read it in flash. Bath when I suggested that solution, my employer was not satisfied... They are in need of practically "plug and play" solution... So my question Is there a way I can list and rename files in folder using only flash whit AIR or ZINC ?

Actually my tong was faster than my brain... I thought for a wile and I remembered that I read something about flash.filesystem.File

Any way problem solved...


import flash.filesystem.File;

function browse(event:MouseEvent):void {
var file:File = new File();
file.addEventListener(Event.SELECT,onDirSel);
file.browseForDirectory(" Browse For Dir ");
}

function onDirSel(event:Event):void {
var fR:File=event.target as File;
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event) {
var dirL:Array=fR.getDirectoryListing();
var files:Array = new Array();
files = dirL;
output.text="";
for each (var file:File in files) {
if (! file.isDirectory) {
output.appendText(file.name + "\n");
}
}

}
}
bro.addEventListener(MouseEvent.CLICK, browse);