home *** CD-ROM | disk | FTP | other *** search
/ Ice Age Fan CD 1 / CD1_Scrat.iso / flash / data / game.swf / scripts / com / google / analytics / utils / Variables.as < prev    next >
Encoding:
Text File  |  2012-07-04  |  4.3 KB  |  174 lines

  1. package com.google.analytics.utils
  2. {
  3.    import flash.net.URLVariables;
  4.    
  5.    public dynamic class Variables
  6.    {
  7.       public var post:Array;
  8.       
  9.       public var URIencode:Boolean;
  10.       
  11.       public var pre:Array;
  12.       
  13.       public var sort:Boolean = true;
  14.       
  15.       public function Variables(param1:String = null, param2:Array = null, param3:Array = null)
  16.       {
  17.          pre = [];
  18.          post = [];
  19.          super();
  20.          if(param1)
  21.          {
  22.             decode(param1);
  23.          }
  24.          if(param2)
  25.          {
  26.             this.pre = param2;
  27.          }
  28.          if(param3)
  29.          {
  30.             this.post = param3;
  31.          }
  32.       }
  33.       
  34.       private function _join(param1:Variables) : void
  35.       {
  36.          var _loc2_:String = null;
  37.          if(!param1)
  38.          {
  39.             return;
  40.          }
  41.          for(_loc2_ in param1)
  42.          {
  43.             this[_loc2_] = param1[_loc2_];
  44.          }
  45.       }
  46.       
  47.       public function join(... rest) : void
  48.       {
  49.          var _loc2_:int = int(rest.length);
  50.          var _loc3_:int = 0;
  51.          while(_loc3_ < _loc2_)
  52.          {
  53.             if(rest[_loc3_] is Variables)
  54.             {
  55.                _join(rest[_loc3_]);
  56.             }
  57.             _loc3_++;
  58.          }
  59.       }
  60.       
  61.       public function toString() : String
  62.       {
  63.          var _loc2_:String = null;
  64.          var _loc3_:String = null;
  65.          var _loc4_:String = null;
  66.          var _loc5_:int = 0;
  67.          var _loc6_:int = 0;
  68.          var _loc7_:String = null;
  69.          var _loc8_:String = null;
  70.          var _loc1_:Array = [];
  71.          for(_loc3_ in this)
  72.          {
  73.             _loc2_ = this[_loc3_];
  74.             if(URIencode)
  75.             {
  76.                _loc2_ = encodeURI(_loc2_);
  77.             }
  78.             _loc1_.push(_loc3_ + "=" + _loc2_);
  79.          }
  80.          if(sort)
  81.          {
  82.             _loc1_.sort();
  83.          }
  84.          if(pre.length > 0)
  85.          {
  86.             pre.reverse();
  87.             _loc5_ = 0;
  88.             while(_loc5_ < pre.length)
  89.             {
  90.                _loc7_ = pre[_loc5_];
  91.                _loc6_ = 0;
  92.                while(_loc6_ < _loc1_.length)
  93.                {
  94.                   _loc4_ = _loc1_[_loc6_];
  95.                   if(_loc4_.indexOf(_loc7_) == 0)
  96.                   {
  97.                      _loc1_.unshift(_loc1_.splice(_loc6_,1)[0]);
  98.                   }
  99.                   _loc6_++;
  100.                }
  101.                _loc5_++;
  102.             }
  103.             pre.reverse();
  104.          }
  105.          if(post.length > 0)
  106.          {
  107.             _loc5_ = 0;
  108.             while(_loc5_ < post.length)
  109.             {
  110.                _loc8_ = post[_loc5_];
  111.                _loc6_ = 0;
  112.                while(_loc6_ < _loc1_.length)
  113.                {
  114.                   _loc4_ = _loc1_[_loc6_];
  115.                   if(_loc4_.indexOf(_loc8_) == 0)
  116.                   {
  117.                      _loc1_.push(_loc1_.splice(_loc6_,1)[0]);
  118.                   }
  119.                   _loc6_++;
  120.                }
  121.                _loc5_++;
  122.             }
  123.          }
  124.          return _loc1_.join("&");
  125.       }
  126.       
  127.       public function decode(param1:String) : void
  128.       {
  129.          var _loc2_:Array = null;
  130.          var _loc3_:String = null;
  131.          var _loc4_:String = null;
  132.          var _loc5_:String = null;
  133.          var _loc6_:Array = null;
  134.          if(param1 == "")
  135.          {
  136.             return;
  137.          }
  138.          if(param1.indexOf("&") > -1)
  139.          {
  140.             _loc2_ = param1.split("&");
  141.          }
  142.          else
  143.          {
  144.             _loc2_ = [param1];
  145.          }
  146.          var _loc7_:int = 0;
  147.          while(_loc7_ < _loc2_.length)
  148.          {
  149.             _loc3_ = _loc2_[_loc7_];
  150.             if(_loc3_.indexOf("=") > -1)
  151.             {
  152.                _loc6_ = _loc3_.split("=");
  153.                _loc4_ = _loc6_[0];
  154.                _loc5_ = decodeURI(_loc6_[1]);
  155.                this[_loc4_] = _loc5_;
  156.             }
  157.             _loc7_++;
  158.          }
  159.       }
  160.       
  161.       public function toURLVariables() : URLVariables
  162.       {
  163.          var _loc2_:String = null;
  164.          var _loc1_:URLVariables = new URLVariables();
  165.          for(_loc2_ in this)
  166.          {
  167.             _loc1_[_loc2_] = this[_loc2_];
  168.          }
  169.          return _loc1_;
  170.       }
  171.    }
  172. }
  173.  
  174.