Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-23-2004, 05:49 AM
Junior Member
 
Join Date: Oct 2004
Posts: 19
Default browse file

hi there! got another issue, tried looking at swfKIT help but havent found anything that you could actually browse a file to copy instead of a folder. any ideas would be appreciated.

thank you
__________________
canned_tooth
Reply With Quote
  #2 (permalink)  
Old 11-24-2004, 10:46 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:browse file

The Dialogs.fileOpen method.
Reply With Quote
  #3 (permalink)  
Old 11-25-2004, 04:09 AM
Junior Member
 
Join Date: Oct 2004
Posts: 19
Default Re:browse file

thanks for the reply and it browse for the file. anyway, been working around it cause i need to do is to get the path of the file to browse and copy it to a different directory. this is how i do it and i cant make it work.

var copyThis = FlashPlayer.getVariable("_root.copyThis");
while (copyThis.search("/") >= 0)
copyThis = copyThis.replace("/", "\\");
var file = new File(copyThis);
return file.copy("c:\\DirectoryName\\"+file.name)

thanks!
__________________
canned_tooth
Reply With Quote
  #4 (permalink)  
Old 11-25-2004, 04:11 AM
Junior Member
 
Join Date: Oct 2004
Posts: 19
Default Re:browse file

Quote:
Originally Posted by clyde
//_root.copyThis holds the path of the browsed file
var copyThis = FlashPlayer.getVariable("_root.copyThis");
//try to replace / with \\
while (copyThis.search("/") >= 0)
copyThis = copyThis.replace("/", "\\");
var file = new File(copyThis);
return file.copy("c:\\DirectoryName\\"+file.name)
__________________
canned_tooth
Reply With Quote
  #5 (permalink)  
Old 11-26-2004, 07:25 AM
Member
 
Join Date: Jan 2003
Posts: 56
Default Re:browse file

Why not just try this:

Code:
//Opens FileOpen Dialog
var lookforwhat = "Some File (*.*)|*.*|";
var filetoload = Dialogs.fileOpen(lookforwhat, "", "", false);

//Checks to see if a file was selected and if it exists, then sets to Flash the location of it to the variable _root.location
        if((filetoload!=false) && (File.exists(filetoload))){
 FlashPlayer.setVariable("_root.location",filetoload);

 //Next, get the name of the file
var nameoffile = new File(filetoload);
filetoload = nameoffile.name;
  FlashPlayer.setVariable("_root.filename",filetoload);
        } //end of if((filetoload!=fal...





//Now, get the location and filename from the Flash file and uses a new location you give it
filename = FlashPlayer.getVariable("_root.filename");
location = FlashPlayer.getVariable("_root.location");
newlocation = "C:\\Documents and Settings\\"+filename;

//Copy the file from the location to the new location
if(File.exists(location)) (new File(location)).copy(newlocation);

//Slight Note: Test to make sure the C:\\Documents and Settings\\ actually works.
Reply With Quote
  #6 (permalink)  
Old 12-06-2004, 01:25 AM
Junior Member
 
Join Date: Oct 2004
Posts: 19
Default Re:browse file

Quote:
Originally Posted by adan
Why not just try this:

Code:
//Opens FileOpen Dialog
var lookforwhat = "Some File (*.*)|*.*|";
var filetoload = Dialogs.fileOpen(lookforwhat, "", "", false);

//Checks to see if a file was selected and if it exists, then sets to Flash the location of it to the variable _root.location
        if((filetoload!=false) && (File.exists(filetoload))){
 FlashPlayer.setVariable("_root.location",filetoload);

 //Next, get the name of the file
var nameoffile = new File(filetoload);
filetoload = nameoffile.name;
  FlashPlayer.setVariable("_root.filename",filetoload);
        } //end of if((filetoload!=fal...





//Now, get the location and filename from the Flash file and uses a new location you give it
filename = FlashPlayer.getVariable("_root.filename");
location = FlashPlayer.getVariable("_root.location");
newlocation = "C:\\Documents and Settings\\"+filename;

//Copy the file from the location to the new location
if(File.exists(location)) (new File(location)).copy(newlocation);

//Slight Note: Test to make sure the C:\\Documents and Settings\\ actually works.
yep, it works fine but i cant use relative path. like if i am running the swf.exe in c:\myExe\application and want to copy the file in c:\myExe using:

newlocation = "..\\"+filename;
=====================

i tried using newlocation = filename; and it copied the file in the source folder ( like if i copy file.pdf in c:\\myPDFs, the copy goes in there too).

hoping for answers.
__________________
canned_tooth
Reply With Quote
  #7 (permalink)  
Old 12-06-2004, 03:05 AM
Junior Member
 
Join Date: Oct 2004
Posts: 19
Default Re:browse file

its all doin fine now, just added getAppDir() and works fine. i just dont know why some of my scripts works without it and some doesnt. ???

cheers! ;D
__________________
canned_tooth
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:34 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.