SharedObject#size reports different values Flash vs HTML5

Hi. I’ve been doing some tests with SharedObject#size and it seems that for an newly created SharedObject instance, size reports different values in Flash and HTML5.

The relevant code is:

var so = SharedObject.getLocal("SharedObjectTest");

In Flash, it prints 0. In HTML5, it prints 2.

Back in the old Flash days, I’ve used (and seen used) checks like (so.size == 0) for simple detection of a new user of the application.

Thanks for looking into this.

You can check the existence of so you don’t have to rely on size

no, it doesn’t work, is never null. you can check in, SharedObject.hx the implementation of SharedObject#getLocal does this: = {};

but anything you put in data is null. come on now :smiley:

settings =;
if ( settings == null ) {

sure, that works or, if you store directly in data atomic types:

someField = Reflect.hasField(, "someFieldName") ? : aDefaultAtomicValue;

was just trying to point out a possible back compatibility issue.

thanks, sounds like this is something we should improve:

Perhaps we could hard-code a -2 in there (if we are bold) or do a null check, I agree we should return 0 as expected