Last active
August 16, 2019 08:04
-
-
Save lynxerzhang/0c94f48aade15c334761067eafcc3d08 to your computer and use it in GitHub Desktop.
Revisions
-
lynxerzhang revised this gist
Aug 16, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class JS_LocalStorage public static function read(_key:String):* { try { var result:* = ExternalInterface.call("function(key) {return window.localStorage.getItem(key); }", _key); return result; }catch(e:Error){ } -
lynxerzhang created this gist
Aug 16, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ package utils { import flash.external.ExternalInterface; //@see https://code.tutsplus.com/tutorials/quick-tip-how-to-communicate-between-flash-and-javascript--active-3370 public class JS_LocalStorage { public function JS_LocalStorage() { } public static function save(_key:String, _value:*):void { try{ ExternalInterface.call("function(key, value) {window.localStorage.setItem(key, value); }", _key, _value); } catch(e:Error){ } } public static function read(_key:String):* { try { var result:* = ExternalInterface.call("function(key) {window.localStorage.getItem(key); }", _key); return result; }catch(e:Error){ } } public static function contain(key:String):Boolean { var result:* = read(key); return result != null && result != undefined; } } }