home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / FishyHop.swf / scripts / __Packages / Fade.as next >
Encoding:
Text File  |  2008-09-05  |  8.1 KB  |  246 lines

  1. class Fade
  2. {
  3.    var bmpRoot;
  4.    var removeMovieClip;
  5.    var getDepth;
  6.    var swapDepths;
  7.    var nTime;
  8.    var nTemp;
  9.    var nT;
  10.    var nRdm;
  11.    var m_0;
  12.    var m_1;
  13.    var finish;
  14.    var switchDepth;
  15.    var nRdm_2;
  16.    var m_2;
  17.    var m_3;
  18.    static var nColor = 0;
  19.    static var nInterval = 20;
  20.    function Fade()
  21.    {
  22.    }
  23.    static function start(_ob)
  24.    {
  25.       var _loc11_ = false;
  26.       var _loc9_ = Stage.width;
  27.       var _loc10_ = Stage.height;
  28.       var _loc13_ = 0;
  29.       var _loc12_ = 0;
  30.       for(var _loc6_ in _ob)
  31.       {
  32.          Fade[_loc6_] = _ob[_loc6_];
  33.       }
  34.       var _loc7_ = new flash.display.BitmapData(_loc9_,_loc10_,false,Fade.nColor);
  35.       _loc7_.draw(_root);
  36.       var _loc3_ = _root.createEmptyMovieClip("mClip_root" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
  37.       var _loc4_ = _loc3_.createEmptyMovieClip("mClip_mask",0);
  38.       var _loc8_ = _loc3_.createEmptyMovieClip("mClip_bmp",1);
  39.       _loc8_.attachBitmap(_loc7_,0);
  40.       _loc3_.nT = Fade.nInterval;
  41.       _loc11_ && Fade.disableBtn(_loc3_);
  42.       _loc3_.bmpRoot = _loc7_;
  43.       _loc3_.nTime = 0;
  44.       _loc3_.finish = function()
  45.       {
  46.          this.bmpRoot.dispose();
  47.          this.removeMovieClip();
  48.       };
  49.       _loc3_.switchDepth = function()
  50.       {
  51.          if(this.getDepth() != _root.getNextHighestDepth() - 1)
  52.          {
  53.             this.swapDepths(_root.getNextHighestDepth() - 1);
  54.          }
  55.       };
  56.       switch(random(4))
  57.       {
  58.          case 0:
  59.             _loc3_.nRdm = random(2);
  60.             _loc3_.m_0 = Fade.createClip("m_",_loc4_,0,0);
  61.             _loc3_.m_1 = Fade.createClip("m_",_loc4_,0,1,{_x:10,_y:10,_rotation:180});
  62.             _loc3_.onEnterFrame = function()
  63.             {
  64.                this.nTime = this.nTime + 1;
  65.                this.nTemp = 50 - Fade.trigonometric(this.nTime,this.nT,50);
  66.                if(this.nRdm > 0)
  67.                {
  68.                   this.m_0._yscale = this.m_1._yscale = this.nTemp;
  69.                }
  70.                else
  71.                {
  72.                   this.m_0._xscale = this.m_1._xscale = this.nTemp;
  73.                }
  74.                if(this.nTime == this.nT / 2)
  75.                {
  76.                   this.finish();
  77.                }
  78.                this.switchDepth();
  79.             };
  80.             break;
  81.          case 1:
  82.             _loc3_.nRdm = random(3);
  83.             _loc3_.nRdm_2 = random(4);
  84.             _loc3_.m_0 = Fade.createClip("m_",_loc4_,1,0,{_x:5,_y:5});
  85.             _loc3_.onEnterFrame = function()
  86.             {
  87.                this.nTime = this.nTime + 1;
  88.                this.nTemp = 100 - Fade.trigonometric(this.nTime,this.nT,100);
  89.                switch(this.nRdm)
  90.                {
  91.                   case 0:
  92.                      this.m_0._xscale = _loc0_ = 150;
  93.                      _loc0_;
  94.                      this.m_0._yscale = _loc0_ = this.nTemp;
  95.                      _loc0_;
  96.                      break;
  97.                   case 1:
  98.                      this.m_0._xscale = _loc0_ = this.nTemp;
  99.                      _loc0_;
  100.                      this.m_0._yscale = _loc0_ = 150;
  101.                      _loc0_;
  102.                      break;
  103.                   case 2:
  104.                      this.m_0._yscale = _loc0_ = this.nTemp;
  105.                      this.m_0._xscale = _loc0_;
  106.                }
  107.                if(this.nRdm_2 == 3)
  108.                {
  109.                   this.m_0._rotation = 180 - Fade.trigonometric(this.nTime,this.nT,180);
  110.                }
  111.                else if(this.nRdm_2 == 2)
  112.                {
  113.                   this.m_0._rotation = Fade.trigonometric(this.nTime,this.nT,180);
  114.                }
  115.                if(this.nTime == this.nT / 2)
  116.                {
  117.                   this.finish();
  118.                }
  119.                this.switchDepth();
  120.             };
  121.             break;
  122.          case 2:
  123.             _loc3_.nRdm = random(5);
  124.             _loc3_.m_0 = Fade.createClip("m_",_loc4_,2,0);
  125.             _loc3_.m_1 = Fade.createClip("m_",_loc4_,2,1,{_x:10,_y:10,_rotation:180});
  126.             _loc3_.onEnterFrame = function()
  127.             {
  128.                this.nTime = this.nTime + 1;
  129.                this.nTemp = 100 - Fade.trigonometric(this.nTime,this.nT,100);
  130.                switch(this.nRdm)
  131.                {
  132.                   case 0:
  133.                      this.m_1._yscale = _loc0_ = this.nTemp;
  134.                      this.m_0._yscale = _loc0_;
  135.                      break;
  136.                   case 1:
  137.                      this.m_1._yscale = _loc0_ = this.nTemp;
  138.                      this.m_0._xscale = _loc0_;
  139.                      break;
  140.                   case 2:
  141.                      this.m_1._xscale = _loc0_ = this.nTemp;
  142.                      this.m_0._yscale = _loc0_;
  143.                      break;
  144.                   case 3:
  145.                      this.m_1._xscale = _loc0_ = this.nTemp;
  146.                      this.m_0._xscale = _loc0_;
  147.                      break;
  148.                   case 4:
  149.                      this.m_1._xscale = _loc0_ = this.nTemp;
  150.                      this.m_0._xscale = _loc0_;
  151.                      this.m_1._yscale = _loc0_ = this.nTemp;
  152.                      this.m_0._yscale = _loc0_;
  153.                }
  154.                if(this.nTime == this.nT / 2)
  155.                {
  156.                   this.finish();
  157.                }
  158.                this.switchDepth();
  159.             };
  160.             break;
  161.          case 3:
  162.             _loc3_.nRdm = random(2);
  163.             _loc3_.m_0 = Fade.createClip("m_",_loc4_,2,0);
  164.             _loc3_.m_1 = Fade.createClip("m_",_loc4_,2,1,{_x:10,_y:10,_rotation:180});
  165.             _loc3_.m_2 = Fade.createClip("m_",_loc4_,2,2,{_x:0,_y:10,_rotation:-90});
  166.             _loc3_.m_3 = Fade.createClip("m_",_loc4_,2,3,{_x:10,_y:0,_rotation:90});
  167.             _loc3_.onEnterFrame = function()
  168.             {
  169.                this.nTime = this.nTime + 1;
  170.                this.nTemp = 100 - Fade.trigonometric(this.nTime,this.nT,100);
  171.                if(this.nRdm > 0)
  172.                {
  173.                   this.m_0._yscale = this.m_1._yscale = this.m_2._yscale = this.m_3._yscale = this.nTemp;
  174.                }
  175.                else
  176.                {
  177.                   this.m_0._xscale = this.m_1._xscale = this.m_2._xscale = this.m_3._xscale = this.nTemp;
  178.                }
  179.                if(this.nTime == this.nT / 2)
  180.                {
  181.                   this.finish();
  182.                }
  183.                this.switchDepth();
  184.             };
  185.       }
  186.       _loc4_._width = _loc0_ = _loc9_;
  187.       _loc0_;
  188.       _loc4_._height = _loc0_ = _loc10_;
  189.       _loc0_;
  190.       _loc4_._x = _loc0_ = _loc13_;
  191.       _loc0_;
  192.       _loc4_._y = _loc0_ = _loc12_;
  193.       _loc0_;
  194.       _loc8_.setMask(_loc4_);
  195.    }
  196.    static function disableBtn(_m)
  197.    {
  198.       _m.onPress = null;
  199.       _m.enabled = false;
  200.       _m.hitArea = _root;
  201.    }
  202.    static function trigonometric(x, T, A, P)
  203.    {
  204.       var _loc2_ = 0;
  205.       var _loc1_ = 3.141592653589793 / T * x;
  206.       if(!isNaN(P))
  207.       {
  208.          _loc2_ = P - _loc1_;
  209.       }
  210.       return A * Math.sin(_loc1_ + _loc2_);
  211.    }
  212.    static function createClip(_s, _m, _nType, _nDepth, _ob)
  213.    {
  214.       isNaN(_nDepth) && (_nDepth = _m.getNextHighestDepth());
  215.       isNaN(_nType) && (_nType = 0);
  216.       _m.createEmptyMovieClip(_s + _nDepth,_nDepth);
  217.       _m[_s + _nDepth].beginFill(0);
  218.       switch(_nType)
  219.       {
  220.          case 0:
  221.             _m[_s + _nDepth].lineTo(10,0);
  222.             _m[_s + _nDepth].lineTo(10,10);
  223.             _m[_s + _nDepth].lineTo(0,10);
  224.             _m[_s + _nDepth].lineTo(0,0);
  225.             break;
  226.          case 1:
  227.             _m[_s + _nDepth].moveTo(-5,-5);
  228.             _m[_s + _nDepth].lineTo(-5,5);
  229.             _m[_s + _nDepth].lineTo(5,5);
  230.             _m[_s + _nDepth].lineTo(5,-5);
  231.             _m[_s + _nDepth].lineTo(-5,-5);
  232.             break;
  233.          case 2:
  234.             _m[_s + _nDepth].lineTo(10,0);
  235.             _m[_s + _nDepth].lineTo(0,10);
  236.             _m[_s + _nDepth].lineTo(0,0);
  237.       }
  238.       _m[_s + _nDepth].endFill();
  239.       for(var _loc5_ in _ob)
  240.       {
  241.          _m[_s + _nDepth][_loc5_] = _ob[_loc5_];
  242.       }
  243.       return _m[_s + _nDepth];
  244.    }
  245. }
  246.