Blog
AS3 Datastore
8 years, 4 months ago Posted in: Blog Comments Off

Utilidad para almacenar datos en SharedObjects

Actionscript:
  1. package com.mattimatti.localdata
  2. {
  3.     import flash.events.EventDispatcher;
  4.     import flash.net.SharedObject;
  5.  
  6.     public class DataStore extends EventDispatcher
  7.     {
  8.  
  9.         public static function load(inStore:String):Object
  10.         {
  11.             var so:SharedObject = SharedObject.getLocal(inStore);
  12.             return so.data;
  13.         }      
  14.        
  15.         public static function save(inStore:String, inData:Object):void
  16.         {
  17.             var so:SharedObject = SharedObject.getLocal(inStore);
  18.        
  19.             for(var prop:String in inData) {
  20.                 so.data[prop] = inData[prop];
  21.             }
  22.             so.flush()
  23.         }      
  24.        
  25.     }
  26. }

Comments are closed.

Image compression on this page is provided by WordPress Image Compressor