1.先在畫面拉一個輸入文字,取名為 input_txt
2.隨便做一個按鈕,取名為 save_btn
3.在主時間軸貼上程式碼:
AS2.0
var so:SharedObject=SharedObject.getLocal("mySaveData", "/");
if(so.data.mySaveData!=null){
input_txt.text=so.data.mySaveData;
}
save_btn.onPress=function(){
so.data.mySaveData = input_txt.text;
so.flush();
}
AS3.0
var so:SharedObject=SharedObject.getLocal("mySaveData","/");
if(so.data.mySaveData!=null){
input_txt.text= so.data.mySaveData;
}
save_btn.addEventListener(MouseEvent.CLICK, function(e:MouseEvent){
so.data.mySaveData = input_txt.text;
so.flush();
});
//---------------------------------------------------------------------------------------------------------
檔案位置:
var so:SharedObject=SharedObject.getLocal("mySaveData", "/");
檔案在:
C:\Documents and Settings\登入者名稱\Application Data\Macromedia\Flash Player\#SharedObjects\xxxxxx\localhost
檔名:mySaveData
如果是寫var so:SharedObject=SharedObject.getLocal("fun/mySaveData", "/");
檔案會在:
C:\Documents and Settings\登入者名稱\Application Data\Macromedia\Flash Player\#SharedObjects\xxxxxx\localhost\#fun
檔名:mySaveData
http://tw.knowledge.yahoo.com/question/question?qid=1508082402461
http://tw.knowledge.yahoo.com/question/question?qid=1608083004985
http://tw.knowledge.yahoo.com/question/question?qid=1609071005840
2 意見:
你好~~~~
那請問shareObject有可以儲存在android的寫法嗎
as3的
sorry~我沒研究android
張貼留言