Help with shared objects

Hi forum,

I’m trying to use a shared object to store a value. So far i have managed to store the value once a user has clicked on an image, and i can retrieve it. However i need to detect if its already there or not on page load. I have this code to do it:


so = SharedObject.getLocal("position");
text1 = so.data.pos_x;
if(so.data.pos_x != undefined){
   //perform this
}

…and it doesn’t work. The value displayed in text1 if the objected isn’t present is - undefined - but it still seems to completely ignore the logic. I’m new to actionscript could someone please give me an idea what might be wrong.