/ Published in: ActionScript 3
                    
                                        
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.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// 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();
Comments
 Subscribe to comments
                    Subscribe to comments
                
                