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

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