Nazmul
Nazmul

Reputation: 7218

Saving xml file in Stand alone machine using actionscript

While developing an application (for KIOSK) using Actionscript I am facing the trouble to store xml data in that machine. What is the way to save xml file using actionscript?

Thank you so much.

Upvotes: 0

Views: 709

Answers (2)

Plastic Sturgeon
Plastic Sturgeon

Reputation: 12527

Flash does not have the ability to save files without user interaction. In a kiosk, I assume you want to save data without having the user have access to the file system. So you will need to use another technology to do this> The most obvious is Adobe AIR, which gives flash all of the powers and permsiions of a desktop application. There are also commercial solutions for creating enhanced projectors (Such as Zinc, and ScreenTime) but I cannot think of a use case for them other than as screensavers, since AIR has been introduced. In air you will be able to save files, or use an SQLite databse.

The code for saving a file using AIR looks something like this:

import flash.filesystem.*;  
import flash.events.Event;  

function saveFile():void {  
    var file:File=File.desktopDirectory;  
    file=file.resolvePath("test.txt");  
    var fileStream:FileStream = new FileStream();  
    fileStream.open(file, FileMode.WRITE);  
    fileStream.writeUTFBytes("Hi this file was saved from AIR application without dialog");  
    fileStream.addEventListener(Event.CLOSE, fileClosed);  
    fileStream.close();  


function fileClosed(event:Event):void {  
    trace("closed event fired");  
}  
}  
saveFile(); 

Posted From here: http://askmeflash.com/tutorial/6/save-file-in-adobe-air-without-dialog-window

Upvotes: 1

cwallenpoole
cwallenpoole

Reputation: 82028

Well that depends on whether you are using AIR or Flash projector, or the Flash plugin. If you're using AIR, and need to be a little bit more verbose, then I would recommend that you store the XML with the SQLite bindings.. In all other cases, I would recommend using a SharedObject.

Upvotes: 0

Related Questions