Maintinain Object type persistance in SharedObject

G’day folks, I’ve got this little problem that’s been confusing me for the past little while. I wrote a little script designed to save and load data using the SharedObject class. This is the meat of what I came up with.


public function saveGame(fileName:String, saveData:Object):void
{
	var saveFile:SharedObject = SharedObject.getLocal(fileName);
	saveFile.data.gameData = saveData;
}
		
public function loadGame(fileName:String):Object
{
	var saveFile:SharedObject = SharedObject.getLocal(fileName);
	return saveFile.data.gameData;
}

Now, this little script works perfectly when I’m dealing with ints, Strings and the like. However, a problem arises when I try to save a custom made Object dedicated to holding data for another class structure. It goes through the saving process just fine, but when I try to load it it gets locked into Object. I can’t access any functions and all (gameData is DataType) comparisons evaluate to false (even when testing against the dataType I saved it as).

So, I ask hopefully, is there something I’m missing? I’d be very grateful for any assistance that might lead to not having to encode all my data in the future.