davej
10-26-2010, 11:27 PM
Hi all
I am running into a bit of a problem. I am building a little air app that lets you select a file and then it will copy it to several directories. now I want the user to be able to browse for the file to be copied. I have this working.
private var fileRef:FileReference;
private function init():void {
fileRef = new FileReference();
fileRef.addEventListener(Event.SELECT, fileRef_select);
}
private function browseAndUpload():void {
fileRef.browse();
message.text = "";
}
private function fileRef_select(evt:Event):void {
trace("file selected "+evt.target.data)
}
I also have code that will copy a file
private function copyFile():void{
var originalLoc:File = File.desktopDirectory.resolvePath("MyNewFile.txt");
var copyLoc:File = File.desktopDirectory.resolvePath("MyNewFileCopy.txt");
originalLoc.copyTo(copyLoc);
}
both work on their own but I cant seem to marry the two. I cant get the file path from the FileReference or convert it to file to work with my copy code. This is for an air app. Any help would be great.
I am running into a bit of a problem. I am building a little air app that lets you select a file and then it will copy it to several directories. now I want the user to be able to browse for the file to be copied. I have this working.
private var fileRef:FileReference;
private function init():void {
fileRef = new FileReference();
fileRef.addEventListener(Event.SELECT, fileRef_select);
}
private function browseAndUpload():void {
fileRef.browse();
message.text = "";
}
private function fileRef_select(evt:Event):void {
trace("file selected "+evt.target.data)
}
I also have code that will copy a file
private function copyFile():void{
var originalLoc:File = File.desktopDirectory.resolvePath("MyNewFile.txt");
var copyLoc:File = File.desktopDirectory.resolvePath("MyNewFileCopy.txt");
originalLoc.copyTo(copyLoc);
}
both work on their own but I cant seem to marry the two. I cant get the file path from the FileReference or convert it to file to work with my copy code. This is for an air app. Any help would be great.