mardi 10 janvier 2017

AS3 / AIR, Generate a .txt file by pressing the save button without dialog box

This is a Flash application to be deployed in Android device thru Adobe Air. I am trying to save the username and score (boxTwo.text + _clickTxt.text) of the user in a notepad .txt file, without any dialog box appearing in android device. It will be generated once the save button (btnSave) is pressed. I can't make it work. Thanks! This is my code:


var so:SharedObject = SharedObject.getLocal("Test");
var f:File=new File("path\to\file.txt")
var str:FileStream=new FileStream();

btnSave.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void
{ = currentFrame;


btnSave.addEventListener (MouseEvent.CLICK, saveFile)
function saveFile(evt):void
{, FileMode.WRITE);
    str.writeUTFBytes(boxTwo.text + _clickTxt.text);

Aucun commentaire:

Enregistrer un commentaire