1203

Local SharedObject wrapper - foarte comod

/** * A class for storing typed data locally. Wraps the SharedObject * class, offering more intuitive access to its functionality. */ class LocalData { /** * Private constructor prevents the instantiation of this class. */ private function LocalData () { } /** * Saves a value to disk using a SharedObject instance. * * @param record The name of the record to retrieve. * @param field The specific field to retrieve within * the specified record. * @value value The new value for the specified field. */ public static function save(record:String, field:String, value:Object):Void { var so:Object = Object(SharedObject.getLocal(record)); so.data[field] = value; so.flush(); } /** * Retrieves a value from disk using a SharedObject instance. * * @param record The name of the record to retrieve. * @param field The specific field to retrieve within * the specified record. * @return The value of the specified field. */ public static function load (record:String, field:String):Object { return Object(SharedObject.getLocal(record)).data[field]; }}
0