home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Esportes / CrossingCup.swf / scripts / __Packages / Thumbrack.as < prev   
Encoding:
Text File  |  2007-12-11  |  4.4 KB  |  140 lines

  1. class Thumbrack extends MovieClip
  2. {
  3.    var arThumb;
  4.    var origheight;
  5.    var origwidth;
  6.    var depth;
  7.    var ctrTween;
  8.    var cpos;
  9.    var cwidth;
  10.    var dz;
  11.    var thumbsize = 68;
  12.    var thumbspace = 72.3;
  13.    var p1 = 0;
  14.    var p2 = 0.35;
  15.    var p3 = 0.7;
  16.    var tt = 0.7;
  17.    function Thumbrack()
  18.    {
  19.       super();
  20.       this.arThumb = new Array();
  21.       this.origheight = this._height;
  22.       this.origwidth = this._width;
  23.       EventCenter.access().addEventListener("thumbMovement",this);
  24.       this.depth = 0;
  25.       this.ctrTween = 0;
  26.       EventCenter.access().addEventListener("goleft",this);
  27.       EventCenter.access().addEventListener("goright",this);
  28.    }
  29.    function endslide()
  30.    {
  31.       this.ctrTween = this.ctrTween - 1;
  32.    }
  33.    function goleft()
  34.    {
  35.       if(this.ctrTween > 0)
  36.       {
  37.          return undefined;
  38.       }
  39.       if(this.cpos <= 0)
  40.       {
  41.          this.cpos = 0;
  42.          return undefined;
  43.       }
  44.       var _loc3_ = 0;
  45.       while(_loc3_ < this.arThumb.length)
  46.       {
  47.          var _loc2_ = this.arThumb[_loc3_];
  48.          var _loc5_ = Math.floor(_loc3_ / 5);
  49.          var _loc4_ = _loc3_ % 5 * 0.05;
  50.          if(_loc5_ >= this.cpos + 3)
  51.          {
  52.             this.ctrTween = this.ctrTween + 1;
  53.             _loc2_.slideTo(_loc2_._x + this.thumbspace,_loc2_._y,this.tt,"easeOutExpo",this.p1 + _loc4_,mx.utils.Delegate.create(this,this.endslide));
  54.             _loc2_.fadeOut(1,"easeOutExpo",this.p1 + _loc4_);
  55.          }
  56.          else if(_loc5_ <= this.cpos - 1)
  57.          {
  58.             this.ctrTween = this.ctrTween + 1;
  59.             _loc2_.slideTo(_loc2_._x + this.thumbspace,_loc2_._y,this.tt,"easeOutExpo",this.p3 + _loc4_,mx.utils.Delegate.create(this,this.endslide));
  60.             _loc2_.fadeOut(0,"easeOutExpo",0);
  61.             _loc2_.fadeIn(1,"easeOutExpo",this.p3 + _loc4_);
  62.          }
  63.          else
  64.          {
  65.             this.ctrTween = this.ctrTween + 1;
  66.             _loc2_.slideTo(_loc2_._x + this.thumbspace,_loc2_._y,this.tt,"easeOutExpo",this.p2 + _loc4_,mx.utils.Delegate.create(this,this.endslide));
  67.          }
  68.          _loc3_ = _loc3_ + 1;
  69.       }
  70.       this.cpos = this.cpos - 1;
  71.    }
  72.    function goright()
  73.    {
  74.       if(this.ctrTween > 0)
  75.       {
  76.          return undefined;
  77.       }
  78.       if(this.cpos >= this.cwidth - 4)
  79.       {
  80.          this.cpos = this.cwidth - 4;
  81.          return undefined;
  82.       }
  83.       var _loc3_ = 0;
  84.       while(_loc3_ < this.arThumb.length)
  85.       {
  86.          var _loc2_ = this.arThumb[_loc3_];
  87.          var _loc5_ = Math.floor(_loc3_ / 5);
  88.          var _loc4_ = _loc3_ % 5 * 0.05;
  89.          if(_loc5_ <= this.cpos)
  90.          {
  91.             this.ctrTween = this.ctrTween + 1;
  92.             _loc2_.slideTo(_loc2_._x - this.thumbspace,_loc2_._y,this.tt,"easeOutExpo",this.p1 + _loc4_,mx.utils.Delegate.create(this,this.endslide));
  93.             _loc2_.fadeOut(1,"easeOutExpo",this.p1 + _loc4_);
  94.          }
  95.          else if(_loc5_ >= this.cpos + 4)
  96.          {
  97.             this.ctrTween = this.ctrTween + 1;
  98.             _loc2_.slideTo(_loc2_._x - this.thumbspace,_loc2_._y,this.tt,"easeOutExpo",this.p3 + _loc4_,mx.utils.Delegate.create(this,this.endslide));
  99.             _loc2_.fadeOut(0,"easeOutExpo",0);
  100.             _loc2_.fadeIn(1,"easeOutExpo",this.p3 + _loc4_);
  101.          }
  102.          else
  103.          {
  104.             this.ctrTween = this.ctrTween + 1;
  105.             _loc2_.slideTo(_loc2_._x - this.thumbspace,_loc2_._y,this.tt,"easeOutExpo",this.p2 + _loc4_,mx.utils.Delegate.create(this,this.endslide));
  106.          }
  107.          _loc3_ = _loc3_ + 1;
  108.       }
  109.       this.cpos = this.cpos + 1;
  110.    }
  111.    function addThumb(thumbdata)
  112.    {
  113.       var _loc4_ = "item" + String(this.depth);
  114.       var _loc2_ = this.dz.attachMovie(thumbdata.identifier,_loc4_,this.depth,{_x:0,_y:0});
  115.       if(thumbdata.height == -1)
  116.       {
  117.          thumbdata.height = _loc2_._height;
  118.       }
  119.       _loc2_._y = thumbdata.height * this.depth;
  120.       this.arThumb.push(_loc2_);
  121.       this.depth = this.depth + 1;
  122.       return _loc2_;
  123.    }
  124.    function thumbMovement(o)
  125.    {
  126.       if(o.horz == false)
  127.       {
  128.          var _loc2_ = Number(o.param);
  129.          _loc2_ = (this.dz._height - this.origheight) / 100 * _loc2_;
  130.          this.dz._y = - _loc2_;
  131.       }
  132.       else
  133.       {
  134.          var _loc3_ = Number(o.param);
  135.          _loc3_ = (this.dz._width - this.origwidth) / 100 * _loc3_;
  136.          this.dz._x = - _loc3_;
  137.       }
  138.    }
  139. }
  140.