This annoying error was shown recently in a Flash project I was working on. At first I thought it was a sandbox problem, but Googling around didn’t help. Some links said it was a Flash 10 problem, but I had been succesfully used almost the exact same code in another project.
This is a shortened version of the code:
var name:String = "/demosite/";
var path:String = "/";
var paramname:String = "test";
var value:String = "myValue";
// Open SharedObject
var _so:SharedObject = SharedObject.getLocal(name, path);
// Create object
var o = new Object();
o.value = value;
o.timestamp = new Date();
_so.data[paramname] = o;
_so.flush(); // Flush to disc
_so.close();
Can you spot what I did wrong? If not, I’ll tell you. It’s the name that causes the “Error #2130 Unable to flush sharedObject” message. Or more exact, the “/” in the name. Replacing it with:
var name:String = "demosite";
..solved the problem. I really like good descriptions in error messages ;)