Return to Snippet

Revision: 40727
at February 6, 2011 05:59 by MaRmAR


Initial Code
// To save variable to ELS (EncryptedLocalStore)
var str:String = "Bob"; 
var bytes:ByteArray = new ByteArray(); 
bytes.writeUTFBytes(str); 
EncryptedLocalStore.setItem("firstName", bytes);

// Read it from ELS
var storedValue:ByteArray = EncryptedLocalStore.getItem("firstName"); 
trace(storedValue.readUTFBytes(storedValue.length)); // traces "Bob"

// Remove it from ELS
EncryptedLocalStore.removeItem("firstName"); 

// Remove EVERY data from ELS
EncryptedLocalStore.reset();

Initial URL


Initial Description
Adobe AIR offers an ability to save small snippets of data locally (eg. users' settings). Works also on Android. EncryptedLocalStore is stored encrypted using AES-CBC 128-bit method. It is not recommended to store more than 10 MB of data because of reading/decrypting speed of AIR.

Initial Title
Adobe AIR: Save snippets of data locally

Initial Tags
data, android

Initial Language
ActionScript 3