code_junkie

How do I share a javascript object between different pages in Adobe AIR?

Nov 11th, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. //write an Object to a file
  2. private function writeObject():void {
  3. var object:Object = new Object();//create an object to store
  4. object.value = asObject.text; //set the text field value to the value property
  5. //create a file under the application storage folder
  6. var file:File = File.applicationStorageDirectory.resolvePath("myobject.file");
  7. if (file.exists)
  8. file.deleteFile();
  9. var fileStream:FileStream = new FileStream(); //create a file stream
  10. fileStream.open(file, FileMode.WRITE);// and open the file for write
  11. fileStream.writeObject(object);//write the object to the file
  12. fileStream.close();
  13. }
Add Comment
Please, Sign In to add comment