Guest User

Untitled

a guest
Aug 9th, 2011
866
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package {
  2. import flash.display.*;
  3. import flash.net.*;
  4. import flash.system.*;
  5. import flash.external.*;
  6.  
  7. public class FlashStore extends Sprite {
  8.  
  9. public var storage:SharedObject;
  10.  
  11. public function FlashStore(){
  12. var key:* = null;
  13. var params:* = null;
  14. super();
  15. Security.allowDomain("*");
  16. Security.allowInsecureDomain("*");
  17. try {
  18. key = "km";
  19. params = LoaderInfo(this.root.loaderInfo).parameters;
  20. if (((params) && (params["k"]))){
  21. key = params["k"];
  22. };
  23. storage = SharedObject.getLocal(key, "/");
  24. ExternalInterface.addCallback("s", setData);
  25. ExternalInterface.addCallback("g", getData);
  26. } catch(e) {
  27. };
  28. try {
  29. if (ExternalInterface.available){
  30. ExternalInterface.call("_kmfsl");
  31. };
  32. } catch(e) {
  33. };
  34. }
  35. public function getData(_arg1:String){
  36. var name:* = _arg1;
  37. try {
  38. return (storage.data[name]);
  39. } catch(e) {
  40. };
  41. }
  42. public function setData(_arg1:String, _arg2):void{
  43. var name:* = _arg1;
  44. var data:* = _arg2;
  45. try {
  46. storage.data[name] = data;
  47. storage.flush();
  48. } catch(e) {
  49. };
  50. }
  51.  
  52. }
  53. }//package
RAW Paste Data