Posted By

febfeb on 04/05/14


Tagged

aktivasi


Versions (?)

Mindmax


 / Published in: ActionScript 3
 

URL: kosong

aktivasi internet

  1. package com.mindmax.utils {
  2. import com.mindmax.utils.*;
  3. import com.mindmax.ui.*;
  4. import com.greensock.*;
  5. import flash.net.*;
  6.  
  7. import com.adobe.images.*;
  8. import com.adobe.utils.StringUtil;
  9.  
  10. import flash.events.*;
  11. import flash.filesystem.File;
  12. import flash.display.*;
  13. import flash.filesystem.FileStream;
  14. import flash.filesystem.FileMode;
  15. import flash.geom.Point;
  16. import flash.geom.Rectangle;
  17. import flash.desktop.NativeApplication;
  18. import flash.desktop.NativeProcessStartupInfo;
  19. import flash.desktop.NativeProcess;
  20.  
  21. import flash.utils.ByteArray;
  22. import flash.printing.PrintJob;
  23.  
  24. import flash.system.fscommand;
  25. import com.mindmax.Information;
  26. import com.mindmax.presentation.Presentation;
  27. import adams.dev.MD5;
  28.  
  29. public class PageUtils {
  30. /** Lisensi */
  31. public static function isLicensed():Boolean{
  32. var so:SharedObject = SharedObject.getLocal("mindmaxapp");
  33. var serial = so.data.sharedata;
  34. if(serial == null){
  35. return false;
  36. }else{
  37. return true;
  38. }
  39. }
  40.  
  41. public static function getLicensedName():String{
  42. var so:SharedObject = SharedObject.getLocal("mindmaxapp");
  43. var username = so.data.username;
  44. return username;
  45. }
  46.  
  47. public static function resetLicense():void{
  48. var so:SharedObject = SharedObject.getLocal("mindmaxapp");
  49. so.data.username = null;
  50. so.data.sharedata = null;
  51. so.flush();
  52. }
  53.  
  54. public static function activateLicenseInternet(username:String,
  55. email:String, serial:String, returnFunc:Function){
  56. var requestVars:URLVariables = new URLVariables();
  57. requestVars.nama = username;
  58. requestVars.email = email;
  59. requestVars.serial = serial;
  60.  
  61. var reg:MD5 = new MD5();
  62. var pc:String = (reg.skey+"").substr(0, 8).toUpperCase();
  63. pc = pc.replace("O", "0");
  64. requestVars.kode_pc = pc;
  65.  
  66. var request:URLRequest = new URLRequest();
  67. request.url = Information.serverURL + "/registerService/";
  68. request.method = URLRequestMethod.GET;
  69. request.data = requestVars;
  70.  
  71. var loader:URLLoader = new URLLoader();
  72. loader.dataFormat = URLLoaderDataFormat.TEXT;
  73. loader.addEventListener(Event.COMPLETE, function(e:Event){
  74. var stringdata:String = e.target.data + "";
  75. var data = JSON.parse(stringdata);
  76. if(data.status == "OK"){
  77. var so:SharedObject = SharedObject.getLocal("mindmaxapp");
  78. so.data.sharedata = serial;
  79. so.data.username = username;
  80. so.flush();
  81. trace("[Activating Lisence] - Success");
  82. }
  83. returnFunc(data);
  84. });
  85. loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, function(e:Event){
  86. trace("[Activating Lisence] - Failed : HTTP_STATUS");
  87. returnFunc({status:"ERROR"});
  88. });
  89. loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(e:Event){
  90. trace("[Activating Lisence] - Failed : SECURITY_ERROR");
  91. returnFunc({status:"ERROR"});
  92. });
  93. loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:Event){
  94. trace("[Activating Lisence] - Failed : IO_ERROR");
  95. returnFunc({status:"ERROR"});
  96. });
  97.  
  98. try
  99. {
  100. loader.load(request);
  101. }
  102. catch (error:Error)
  103. {
  104. trace("Unable to load URL");
  105. trace("[Activating Lisence] - Failed");
  106. returnFunc({status:"ERROR"});
  107. }
  108. }
  109.  
  110. }
  111. }

Report this snippet  

You need to login to post a comment.