Hi everyone,
I'm working on a way to get a file saved locally to track user variables on a Captivate file that is exececuted from the harddrive of the same system. I created a function in my custom question widget as follows:
function sendAnswerToText() { // create the file var directoryID:String = cpVariables.userID; var sessionNumber:String = cpVariables.sessionNumber; var questionRound:String = cpVariables.questionRound; var timeDate:Date = new Date; var timeStamp:String = timeDate.fullYear + "." + timeDate.month + "." + timeDate.date + "_" + sessionNumber; var file:File = File.desktopDirectory; file = file.resolvePath("Results/" + directoryID + "/" + directoryID + "_" + timeStamp + ".txt"); // create a stream to write and open in APPEND mode var stream:FileStream = new FileStream(); stream.open(file, FileMode.APPEND); // add a new line to the text file var questionID:String = cpVariables.cpInfoCurrentSlide; var questionAnswer:String = properties.answerGridBox + " " + properties.answerCategory; stream.writeUTFBytes((questionRound + "." + questionID + "," + questionAnswer + "," + answerBox + " " + answerCat + "," + resultStatus + "," + slideStart + "," + slideEnd + "\n" )); stream.close();}
This is working perfectly when I preview the project from within Captivate. However when I publish the captivate file in any format (tried .swf, .exe, .app) the file crashes when the function is called. Any idea why?
Using: Captivate 6.1.0.319 and Flash CS6 publishing AIR 3.4 (to publish the question widget .swf)
Thanks.