您好我正在为我创建的游戏整合内部离线本地化排行榜。
使用Array& amp;共享对象。
我认为这会有效,但当我追踪值时,它们会返回[object Object]
代码写的是:import flash.net.SharedObject;
var HScores:SharedObject = SharedObject.getLocal("HighScoresValues");
// ASSIGN Text Fields to Vars
var USR_Level_Reached = LevelTXT.text;
var USR_Name = PlayerTXT.text;
// array
var highScores:Array = new Array();
if(HScores.data.d_SCORES==undefined)
{
HScores.data.d_SCORES = highScores;
} else {highScores.push({score:int(0) , player:"No Name"}); }
if(HScores.data.d_SCORES)
{
highScores = HScores.data.d_SCORES;
}
Button1.addEventListener(MouseEvent.CLICK, Button1_MouseClickEvent);
function Button1_MouseClickEvent(event:MouseEvent)
{
USR_Level_Reached = LevelTXT.text;
USR_Name = PlayerTXT.text;
highScores.push({score:int(USR_Level_Reached) , player:String(USR_Name)});
highScores.sortOn("score", Array.DESCENDING | Array.NUMERIC);
HScores.data.d_SCORES = highScores;
HScores.flush();
trace("Shared Data = "+HScores.data.d_SCORES);
trace("Array Data = "+highScores);
}
不确定我是不是错了, 但它没有按下按钮,将新文本字段传递给我的数组
尽管数组似乎在为自己添加空白值 &安培;还正确地将其空值传递给SharedObjects 但跟踪为[对象对象],[对象对象],[对象对象]?
任何想法?