|
|||
|
Hi
I am trying to copy a file specified through an xml to a path you can chose from a filesave dialog. SWF script //copy //var basePath = FlashPlayer.getVariable("_root.cale"); - tried this also , doesn't work var basePath = Global.getAppDir()+"\\"; doesn't work var ourFile = FlashPlayer.getVariable("_root.lng_p4_exe"); - works var path = basePath+"Products\\Products\\"+ourFile; var file = new File (ourFile); var f = "file(*.*)|*.*|"; a=file.name; var res = Dialogs.fileSave(f, ".exe", ""+a); var outPath = res; file.copy(outPath); problem here: var basePath = Global.getAppDir()+"\\"; this line returns undefined I i use in flash the var basePath = Global.getAppDir()+"\\"; it works but i can't pass it to swfkit var basePath = FlashPlayer.getVariable("_root.cale"); doesn't work Any ideas? If you need more info i'll tell more Thanks a lot. |
|
|||
|
it looks like ffish script code, so you cannot use "Global.getAppDir()", but "getAppDir()" directly. "Global" is a wrapper class for actionscript.
If you use Code:
var basePath = Global.getAppDir()+"\\"; it works |
|
|||
|
Thanks
After you reply i decided to do everything in flash to avoid variable transfer problems. although there were some other posts about copying files that i read before posting here none of them was complete.So here you go, there are 2 ways of copying files. 1. One of them is with the file save dialogue: on(release) { import SWFKit.*; var basePath = Global.getAppDir() + "\\"; var path = basePath+"Product_path\\"+_root.imported_path_from _xml; //_root.imported_path_from_xml contains also the file name and extension var ourFile = path; textpath.text = ourfile; var file = new File (ourFile); var f = "somename(*.exe)|*.exe|"; a=file.name; var res = Dialogs.fileSave(f, ".exe", a); var outPath = res; file.copy(outPath); } 2. The other way is by using a Dialogs.browse component on(release) { import SWFKit.*; var basePath = Global.getAppDir() + "\\"; var path = basePath+"Product_path\\"+_root.imported_path_from _xml; //_root.imported_path_from_xml contains also the file name and extension var ourFile = path; var srcName = path if (!File.exists(srcName)) return false; var pathc = Dialogs.browse("Please choose a path:"); if (pathc == false) return false; pathc += "\\"; var file = new File(srcName); pathc += file.name; return file.copy(pathc); } Both of them work great.You can use wich one is best suited for you. |
|
|||
|
Hi
I bring back the file copy issue. Is there any way to test the finish of the copying process. Having this command f.copy(path), can i show a progress for this operation, or at least the beginning and the success of the operation? on(release) { f.copy(path); if (f.copy(path) in progress) { Dialogs.msgBox("copying"); } else { Dialogs.msgBox("done"); } } Thanks |
|
|||
|
As i have found out , the copy action is kinda linear, that means the copyiing actions hangs the application and the passes on to the next action when it's finished.
var path = Dialogs.browse(_text); if (path == false) { ----------some action return false; } f.copy(path); ------------some other action The problem is with the application not responding until completion. Is there any way to copy in a new thread? |
|
|||
|
Hello @mc_toto:
Make sure your file from relative path! But it is problematy because you are using with Windows 7 / Vista. Do not forget for clicking to privatage administrator like in Contentmenu Run Administrator .. than Your swfkit application will to prompt before to coniture than you can work with copy functions.. Thanks! I hope you because you understand sure.. I am using Windows 7, too
__________________
Sorry I am deaf! I have problem with eys... Thanks! |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|