基本的に、タイトルが示すように、配列を共有オブジェクトに保存できません。
さまざまな特性(ヘルス、アーマー、武器、位置、経験、レベル)などを持つさまざまな「兵士」を含む配列があり、それをどのように保存するのか疑問に思っていました。swf をリロードすると、このトレース (",,,") が得られますが、リロードする前に正しい配列の読み取り値が得られます。
それが役立つ場合、これは私のコードです:
//Saving game
function saveGame(E:MouseEvent){
var so:SharedObject = SharedObject.getLocal("saveFile"); //Instantiating the shared object
so.data.savedUnitArray = towerDefenceMain.unitArray;// is the array that stores the Soldiers
trace(so.data.savedUnitArray); //returns correct trace
so.flush();//Saving the operation
}
//Loading the data back
var so:SharedObject = SharedObject.getLocal("saveFile");
if(so.data.savedUnitArray != undefined){
unitArray = so.data.savedUnitArray;
trace(unitArray); //returns (",,,,")
}