-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMultiSaveString.as
More file actions
79 lines (70 loc) · 1.54 KB
/
MultiSaveString.as
File metadata and controls
79 lines (70 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package save
{
import flash.net.SharedObject;
public class MultiSaveString
{
private static var saveId:Vector.<SharedId> = new Vector.<SharedId>()
private var id:String;
public function MultiSaveString()
{
}
public function setup(saveId_p:String):void
{
if(getSharedObject(saveId_p)==null)
{
var shard:SharedId = new SharedId()
shard.SharedObj = SharedObject.getLocal(saveId_p)
shard.sharedName = saveId_p
saveId.push(shard)
}
id = saveId_p
}
private function getSharedObject(id_p:String):SharedObject
{
for each(var index:SharedId in saveId)
{
if(index.sharedName == id_p) return index.SharedObj
}
return null
}
public function get value():String
{
if(getSharedObject(id).data.value==undefined)
{
return ''
}
return shallowCopy(getSharedObject(id).data.value)
}
private function shallowCopy(sourceStr:String):String
{
var _copyValue:String = sourceStr
return _copyValue;
}
public function set value(Value_p:String):void
{
getSharedObject(id).data.value = shallowCopy(Value_p)
flushingFun();
}
public function Clear():void
{
getSharedObject(id).data.value = null;
flushingFun();
}
public function Delete():void
{
delete getSharedObject(id).data.value;
}
private function flushingFun():void
{
var flushStatus:String = null;
try
{
flushStatus = getSharedObject(id).flush();
}
catch (error:Error)
{
SaffronLogger.log("Error...Could not write SharedObject to disk");
}
}
}
}