home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / pup_idol.swf / scripts / com / memecounter / Tracker.as
Encoding:
Text File  |  2008-08-07  |  3.3 KB  |  118 lines

  1. package com.memecounter
  2. {
  3.    import flash.display.*;
  4.    import flash.events.*;
  5.    import flash.net.*;
  6.    import flash.system.*;
  7.    import flash.utils.*;
  8.    
  9.    public class Tracker
  10.    {
  11.       
  12.       private static var ori_dom:String;
  13.       
  14.       private static var lurl:String;
  15.       
  16.       private static var _isReady:Boolean = false;
  17.       
  18.       public static var a:uint = 0;
  19.       
  20.       public static var root:DisplayObject;
  21.       
  22.       public static var c:uint;
  23.       
  24.       public static var d:String = "";
  25.       
  26.       private static var _isInited:Boolean = false;
  27.       
  28.       public static var fpv:String = "";
  29.       
  30.       private static var l:Loader;
  31.       
  32.       private static var tracker:MovieClip;
  33.       
  34.       public static var da:Array = ["distralytics.com","distralytics.co.uk"];
  35.        
  36.       
  37.       public function Tracker()
  38.       {
  39.          super();
  40.       }
  41.       
  42.       private static function loadError(param1:Event) : void
  43.       {
  44.          ++a;
  45.          lc();
  46.       }
  47.       
  48.       public static function init(param1:DisplayObject, param2:uint) : void
  49.       {
  50.          var _loc3_:uint = 0;
  51.          if(!_isInited)
  52.          {
  53.             _isInited = true;
  54.             root = param1;
  55.             Tracker.c = param2;
  56.             _loc3_ = 0;
  57.             while(_loc3_ < da.length)
  58.             {
  59.                Security.allowDomain(da[_loc3_],param2 + ".c." + da[_loc3_],"*." + da[_loc3_]);
  60.                _loc3_++;
  61.             }
  62.             ori_dom = root.hasOwnProperty("ori_dom") ? String(root["ori_dom"]) : "";
  63.             d = ori_dom != "" ? ori_dom : (root.loaderInfo.loaderURL.split("/")[0].indexOf("http") == -1 ? "Local" : String(root.loaderInfo.loaderURL.split("/")[2].split("?")[0]));
  64.             fpv = Capabilities.version.split(" ")[1].split(",")[0];
  65.             lurl = "/control/tracking/trackerAS3.swf" + "?c=" + param2 + "&r=" + Math.floor(Math.random() * 10000000000) + "&d=" + d + "&p=" + fpv + "&as=3";
  66.             l = new Loader();
  67.             l.contentLoaderInfo.addEventListener(Event.INIT,loadComplete);
  68.             l.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,loadError);
  69.             lc();
  70.          }
  71.       }
  72.       
  73.       public static function get isReady() : Boolean
  74.       {
  75.          return isReady;
  76.       }
  77.       
  78.       public static function kvClick(param1:uint) : void
  79.       {
  80.          if(_isReady)
  81.          {
  82.             tracker.kvClick(param1);
  83.          }
  84.       }
  85.       
  86.       public static function kvCountry() : String
  87.       {
  88.          if(_isReady)
  89.          {
  90.             return tracker.kvCountry();
  91.          }
  92.          return "";
  93.       }
  94.       
  95.       public static function kvEvent(param1:uint) : void
  96.       {
  97.          if(_isReady)
  98.          {
  99.             tracker.kvEvent(param1);
  100.          }
  101.       }
  102.       
  103.       private static function lc() : void
  104.       {
  105.          var _loc1_:String = "http://" + c + ".c." + da[a % da.length] + lurl;
  106.          Security.allowDomain(_loc1_);
  107.          l.load(new URLRequest(_loc1_));
  108.       }
  109.       
  110.       private static function loadComplete(param1:Event) : void
  111.       {
  112.          tracker = param1.target.content;
  113.          tracker.init(getDefinitionByName("com.memecounter.Tracker"),root);
  114.          _isReady = true;
  115.       }
  116.    }
  117. }
  118.