How to View and Save Text in Flash

Save Data from External Text file

Page 1 of 1

0 Replies - 1212 Views - Last Post: 12 October 2009 - 08:37 PM

#1 arismae  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-October 09

How to View and Save Text in Flash

Posted 12 October 2009 - 08:37 PM

Gudday can i ask how do i read and save data in text file in FLASH?
i would like to a game, wherein i can save the status of the character like Final fantasy

on (release)
{
	if(userText_txt.text != "")
	{
		myText = userText_txt.text;
		getURL("java script:WriteToFile('"+myText+"')")
	}
}




function activeObject()
{

		document.write("<HTML><HEAD><meta http-equiv=Content-Type content=text/html;  charset=ISO-8859-1\"><TITLE>Save text</TITLE>");
		document.write("</HEAD><BODY bgcolor=\"#ffffff\" onunload=\"finish()\"><table align=\"center\"><tr><td><OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" WIDTH=\"788\" HEIGHT=\"541\" id=\"shell\" ALIGN=\"\"> <PARAM NAME=movie VALUE=\"shell.swf\"> <PARAM NAME=quality VALUE=high> <PARAM NAME=menu VALUE=false> <PARAM NAME=loop VALUE=false><PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src=\"shell.swf\" quality=high bgcolor=#FFFFFF  WIDTH=\"788\" HEIGHT=\"541\" NAME=\"shell\" ALIGN=\"\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED></OBJECT></table></tr></td></BODY></HTML>");

}

function WriteToFile(sText)
{
	//alert(sText)
	var fso = new ActiveXObject("Scripting.FileSystemObject");
	var FileObject = fso.OpenTextFile("C:\\LogFile.txt", 8, true,0); // 8=append, true=create if not exist, 0 = ASCII
	FileObject.write(sText);
	FileObject.close();
	delete FileObject;
	delete fso;
}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1