-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99f454d
commit b813feb
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
KSKInterface/src/sg/edu/smu/ksketch2/utils/KSketch_MigrateCache.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Created by ramvibhakar on 02/08/15. | ||
*/ | ||
package sg.edu.smu.ksketch2.utils { | ||
import flash.net.SharedObject; | ||
import com.adobe.serialization.json.JSON; | ||
import sg.edu.smu.ksketch2.canvas.controls.KSketch_CacheControl; | ||
|
||
public class KSketch_MigrateCache { | ||
private var _mySOV1:SharedObject = SharedObject.getLocal("mydata"); | ||
private var _cacheControl:KSketch_CacheControl = new KSketch_CacheControl(null); | ||
public function KSketch_MigrateCache() { | ||
} | ||
public function migrateData(){ | ||
if(_mySOV1.data){ | ||
if(_mySOV1.data.userSketch) { | ||
var obj:Object = com.adobe.serialization.json.JSON.decode(_mySOV1.data.userSketch, true); | ||
buildCacheV2(obj.sketches) | ||
} | ||
} | ||
} | ||
private function buildCacheV2(sketches:Array){ | ||
if(sketches){ | ||
for(var i:int=0; i<sketches.length;i++){ | ||
_cacheControl.addToCache(sketches[i]); | ||
} | ||
_mySOV1.clear(); | ||
} | ||
|
||
} | ||
} | ||
} |