How to save user settings in Adobe Flex / AIR

What is the standard way to store user preferences in a Flex application for AIR? I need to store simple parameters like lists of recently opened files, position and size of windows, etc.

+3
source share
4 answers

I think the most flexible way is to use a local SQLite database. This gives you unlimited, structured storage and encryption, if necessary. See Peter Elst's introduction for more information.

+5
source

- VO LSO ( ). , . , , .

, 5 LSO. , , .

registerClassAlias("SettingsVO",SettingsVO);  //This lets us store a typed object in LSO
var settings:SettingsVO;
var settingsSO = SharedObject.getLocal("settings");   
//Check to make sure settings exist... if not, create a new settings object
if( settingsSO.size && settingsSO.data && settingsSO.data.settings){
    settings = settingsSO.data.settings as SettingsVO;
}else{
    settings = new SettingsVO();
}

, ,

settings.someSetting = "newValue";
settingsSO.data.settings = settings;
settingsSO.flush();

BOTH AIR Flex . cookie, .

+7

, , , uesr, .

, SQL Server MySQL; flex, .

Shared , Flash- cookie . ( , AIR). .

XML- . ; , .

AIR , SQLite. SQLite - , Adobe AIR.

+4

I'm not worried about any of the bizarre things. Just save it in an XML file in the application directory. Done.

Filestream generates an error if you try to save it using File.applicationDirectory. I'm just fooling a program ...

var trickFile:File = File.applicationDirectory;
var file:File = new File(trickFile.nativePath + mySettings.xml);

Air is falling every time.

+2
source

All Articles