闪存AS3,保存和iOS和Android游戏加载数据 [英] Flash AS3, save and load data for iOs and android games
问题描述
我试图让游戏iOS和Android。我如何保存数据的小工具,以及如何加载呢?我要保存到用户设备中的数据,基本上只是一堆字符串。请帮忙吧。
I'm trying to make games for iOS and Android. How do I save data to the gadget, and also how do I load it? The data that I want to save to the user device is basically just a bunch of strings. Kindly help please.
顺便说一句,我使用的Flash CS6的游戏。
And by the way, I'm using Flash CS6 for the game.
推荐答案
SharedObject类应该做的罚款你。你写的属性/读取可以是任何类型(字符串,数组,数字,布尔值,XML,...)。
The SharedObject class should do fine for you. The attributes you write/read can be of any type (String, Array, Number, Boolean, XML, ...).
基本例如:
var scores : Array = new Array(10, 20, 30);
var my_so : SharedObject = SharedObject.getLocal("myGameHighscore");
my_so.data.scores = scores; // set scores var to data object of SharedObject
my_so.flush(); // writes the data instantly
// To retreive your scores simply use getLocal again and then do something like:
trace(my_so.data.scores[0]); // will trace first element of scores array "10"
请参考这个网址:<一href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html
这篇关于闪存AS3,保存和iOS和Android游戏加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!