Posted by webfraggle in SWF Studio V3 on Mar 11 2008, 08:38 am

We are trying to copy a file from CD to HD with a progress bar. This works very fine. But now we additionally need error handling and if we add the callback object the progress doesn't work anymore.

Here is our current code:

ssCore.FileSys.copyFileWithFeedback({from:inPath, to:outPath, progressVar:'_level0.myProgressVar'}, {callback:onCopyCallback});

_level0.watch('myProgressVar', copyProgress);

function copyProgress(prop, oldVal, newVal) {
 percent = Math.round((newVal/myFilesize)*100);
 copywindow.progressLocal.percenttext.text = percent+' %';
}

function onCopyCallback(return_obj,callback_obj,error_obj) {
 debug.text = "error: "+error_obj.code;
}


Any hints or tips?

Many thanks
webfraggle


Posted by mbd in SWF Studio V3 on Mar 11 2008, 09:44 am

When you provide a callback data is only returned once the command has completed.

FileSys.copyFileWithFeedback is deprecated in 3.5. We recommend that you use FileSys.copyFileAsync instead. With copyFileAsync you can specify a callback, which will be called when the command completes either successfully or as a result of a failure. To get the progress information you setup a notification using FileSys.setNotify, listening for the onCopyProgress event.


Posted by webfraggle in SWF Studio V3 on Mar 12 2008, 08:59 am

Thank you very much, taht works fine. And we're impressed how fast we got that solution from the support. Great.