A Shared Object Handler Class

Hey guys - first ever experiment with classes; so just starting with something easy cause I will never read any tutorials :smiley: I have to start little; anyways this handles shared objects in a more array-based format which some may find easier;

[SIZE=“6”]prepareSO (prepareSO Method)[/SIZE]
[SIZE=“3”]prepareSO : [FONT=“Courier New”]Void[/FONT][/SIZE]
Opens a local shared object file ready for reading/writing. Must be called to use any of the functions below.
[SIZE=“3”]Parameters[/SIZE]
_lsoName : [FONT=“Courier New”]String [/FONT]- The filename of the shared object.
path : [FONT=“Courier New”]String[/FONT]- The path to save the shared object. Default is “/”.
minDiskSpace : [FONT=“Courier New”]Number[/FONT] - An integer specifying the number of bytes that must be allotted for this object. The default value is 0.

[SIZE=“3”]saveLSO : [FONT=“Courier New”]Void[/FONT][/SIZE]
Saves the data to the shared object.
[SIZE=“3”]Parameters[/SIZE]
_flush : [FONT=“Courier New”]Boolean[/FONT]- A boolean value specifying whether or not to flush the shared object, this is compulsary.
**Note: **It is after the boolean value you specify the rest of the data values, as you would an array; for example; saveLSO(true, “value 1”, 6, true)

[SIZE=“3”]modifyLSO : [FONT=“Courier New”]Void[/FONT][/SIZE]
Modifies the shared object’s value at the specified index.
[SIZE=“3”]Parameters[/SIZE]
index : [FONT=“Courier New”]Number [/FONT]- The index of the value to modify.
value : [FONT=“Courier New”]Object [/FONT]- The new value of the variable.
_flush : [FONT=“Courier New”]Boolean[/FONT]- A boolean value specifying whether or not to flush the shared object, this is compulsary.

[SIZE=“3”]getLSO : [FONT=“Courier New”]Object[/FONT][/SIZE]
Returns the data of the shared object.

[SIZE=“3”]deleteLSO: [FONT=“Courier New”]Void[/FONT][/SIZE]
Deletes the data of the shared object saved using this method.

[SIZE=“3”]Simple Local Shared Object class[/SIZE]

class com.doLSO.prepareSO {
 private var myLSO:SharedObject;
 private var dataObj:Object;
 private var minDiskSpace:Number;
 public function prepareSO(_lsoName:String, path:String, minDiskSpace:Number) {
  minDiskSpace = minDiskSpace == undefined ? 0 : minDiskSpace;
  myLSO = SharedObject.getLocal(_lsoName, path ? path : "/");
 }
 public function saveLSO(_flush:Boolean):Void {
  dataObj = {};
  arguments.shift();
  dataObj.dataArray = arguments;
  myLSO.data.dataObj = dataObj;
  doFlush(_flush);
 }
 public function modifyLSO(index:Number, value:Object, _flush:Boolean):Void {
  myLSO.data.dataObj.dataArray[index] = value;
  doFlush(_flush);
 }
 public function getLSO():Object {
  return myLSO.data.dataObj.dataArray;
 }
 public function deleteLSO():Void {
  delete myLSO.data.dataObj;
 }
 private function doFlush(arg:Boolean):Void {
  if (arg) {
   myLSO.flush(minDiskSpace);
  }
 }
}

[SIZE=“3”]Example[/SIZE]
The follwing shows usage of this class;

import com.doLSO.prepareSO;
var makeSLO:prepareSO = new prepareSO("myLSO","/");
makeSLO.saveLSO(true,"infoBit 1", "infoBit 2", "infoBit 3");
trace(makeSLO.getLSO());// returns an array ("infoBit 1", "infoBit 2", "infoBit 3")
trace(makeSLO.getLSO()[0]);// returns the first bit of data sent ("infoBit 1")
trace(makeSLO.getLSO()[1]);// returns the second bit of data sent ("infoBit 2")
trace(makeSLO.getLSO()[2]);// returns the third bit of data sent ("infoBit 3")
makeSLO.modifyLSO(1, "Apple",true);// modifies the second bit of data sent ("infoBit 2") to say "Apple"
trace(makeSLO.getLSO()[1]);// now it should output "Apple" there
trace(makeSLO.deleteLSO());// Wipes the saved data (Should trace undefined)

Tell me your thoughts