Writing Files to Excel in AS3
Hi,
i have a game that automatically records players interactions. Now I want to write the data to an excel file and use the formular functions of excel.
I was able to write to cvs file but I am aware I cant use the excel formular with this approach.
what do I need to do?
here is the code:
//in spacegame class
public var file:File = File.desktopDirectory.resolvePath( "LogOutput_2Player_1Cannons_DANCEMAT.xlsx" );
public var stream:FileStream = new FileStream();
public function logString(s:String): void
{
var today = new Date();
stream.open(file,FileMode.APPEND);
stream.writeUTFBytes(today.getDate()+"/"+(today.getMonth()+1)+"/"+today.getFullYear()+ "-" +today.getHours()+":"+today.getMinutes()+ ":"+today.getSeconds());
stream.writeUTFBytes(":"+s+"\r\n");
stream.close();
}
//in player class
private function onKeyPress(evt:KeyboardEvent)
{
if (evt.keyCode == 39 )
{
rightArrow = true;
spacegame.instance.rightCircle.visible = true;
spacegame.instance.logString("Player 1 PRESSES RIGHT KEY");
}
}
when you run the game and player interact , an excel file is created with this data in it:
| 23/6/2013-21:19:55:324:Player 1 PRESSES RIGHT KEY |
here it is in one column but I want the file to put the date in one column, the time in one column, player1 in one column and presses right ke in one column
Regards
chiggy