actionscript-3flushshared-objectslocal-shared-object

Flush my sharedObject in as3 - delete all states and start from the beginning


I was hoping someone could help. I would assume this to be a straight forward thing to do yet seem to be struggling with it a bit. I'm novice to using sharedObjects although it's becoming a bit more familiar to me.

I'm wanting to wipe all sharedObject data at the touch of a button... that's all. The trace is showing up but there is no activity.

reset_btn.addEventListener(MouseEvent.CLICK, startover);

function startover(event:MouseEvent):void
{
 //gotoAndPlay(2);
    //reset_balloon.visible = true;
    mySO = SharedObject.getLocal("iDesign");
    delete mySO.data.my_y; 
    //delete mySO.data.mybut_x;
    //delete mySO.data.mybut_y;
    delete mySO.data.mytig_x;
    delete mySO.data.mytig_y;   
    delete mySO.data.mybow_x;
    delete mySO.data.mybow_y;
    delete mySO.data.myblkbow_y;
    delete mySO.data.myblkbow_x;
    delete mySO.data.mybut_x;
    delete mySO.data.mybut_y;
    mySO.flush();
    trace("deleteinside");
}

Any clues?

UPDATES TO CODE -------------------------------

reset_btn.addEventListener(MouseEvent.CLICK, startover);

function startover(event:MouseEvent):void
  {
    mySO = SharedObject.getLocal("iDesign");
    //delete mySO.data.my_y; 
    //delete mySO.data.mybut_x;
    //delete mySO.data.mybut_y;
    //delete mySO.data.mytig_x;
    //delete mySO.data.mytig_y; 
    //delete mySO.data.mybow_x;
    //delete mySO.data.mybow_y;
    //delete mySO.data.myblkbow_y;
    //delete mySO.data.myblkbow_x;
    //delete mySO.data.mybut_x;
    //delete mySO.data.mybut_y;
    mySO.flush();
    trace("deleteinside");
    mySO.clear();
}

Ignore all of the deletes.


Solution

  • The easiest way to wipe all SharedObject data is to call mySO.clear().