[ActionScript 3.0] SharedObject的用法简介

 1 package com.models
 2 {
 3     import flash.net.SharedObject;
 4 
 5     /**
 6      * @author 
 7      * @E-mail 
 8      * @create 2015-6-12 下午2:49:03
 9      *
10      */
11     public class AppModel
12     {
13         
14         private static var _so:SharedObject;
15         
16         public function AppModel()
17         {
18         }
19         
20         public static function getSO():SharedObject
21         {
22             if (!_so)
23             {
24                 _so = SharedObject.getLocal("yenSO");
25             }
26             return _so;
27         }
28         public static function setShareObjectData(name:String,data:Object):void
29         {
30             getSO().data[name] = data;
31             getSO().flush();
32         }
33         public static function getShareObjectData(name:String):Object
34         {
35             return getSO().data[name];
36         }
37     }
38 }

 

posted on 2015-06-17 17:01  晏过留痕  阅读(345)  评论(0编辑  收藏  举报