Skip to main content

Posts

Showing posts from April, 2007

超簡單版MobileSharedObject class

其實這個分享是比較有點懶人系列(Erin最愛)的意味,
只是將Mobile SharedObject建立步驟用class包裝起來,
請注意!這邊不是在講PC版的SharedObject用法喔!

◎MobileSharedObject(soName:String)
+ onLoad(init:Boolean)
+ write (attribute:String, value:Object)
+ read (attribute:String):Object
+ readAll():Object
+ clear()

用法很簡單:
var mySo = new MobileSharedObject();
mySo.onLoad = function(init) {
if (init) {
trace("First time to see you");
this.write("author", "Erin");
this.write("date", "04/02/2007");
} else {
trace("Hello "+this.read("author")+", nice to see you again");
var obj = this.readAll();
for (var i in obj) {
trace(i+"="+obj[i]);
}
}
};

有興趣可以按此下載