| Previous | Next | |
STF.downloadFile(fileName:String, URL:String) : BooleanfileName - Name of local file (including relative path from the screen saver swf) where the downloaded file will be saved. If the relative path does not exist, it will be created.
The screen saver swf is located in the screen saver's working directory. If you need the file in a location other than the working directory, download it and copy it to the desired location using STF.copyFile().
URL - URL of the remote file to be downloaded.
A boolean.; ; This value is returned as a parameter to the registered callback. See the example below or STF.registerCallBack() for more information on return variable handling.
Method; Downloads a remote file onto the local computer.
The following example downloads an image to the "images" folder in the working directory.
var localFileName = "tibet1.jpg";
var remoteFileName = "http://www.screentime.com/temp/3.jpg";
downloadFile_btn.onPress = function() {
if (isConnected) {
STF.downloadFile(localFileName, remoteFileName);
} else {
STF.trace("downloadFile disabled: no connection available");
}
};
//define callback
onDownloadFileReturn = function (returnValue:Boolean){
downloadSuccessful = returnValue;
if (downloadSuccessful) {
image_mc._xscale = 20;
image_mc._yscale = 20;
image_mc.loadMovie(localFileName);
}
}
//initialize watch
STF.registerCallBack("downloadFile", onDownloadFileReturn, this);STF.checkNetConnection(), STF.getSpecialFolder()
| Questions or Feedback? | Previous | Next |