home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / RES / WINDOWS / OWIntro.as < prev    next >
Encoding:
Text File  |  2008-09-12  |  5.7 KB  |  204 lines

  1. package RES.WINDOWS
  2. {
  3.    import ENGINE.CORE.OGlobal;
  4.    import ENGINE.DISPLAY.OBitmap;
  5.    import ENGINE.DISPLAY.ODisplay;
  6.    import ENGINE.DISPLAY.OSprite;
  7.    import ENGINE.INTERFACE.OIObject;
  8.    import ENGINE.INTERFACE.OWindow;
  9.    import flash.display.DisplayObject;
  10.    import flash.events.Event;
  11.    import flash.events.MouseEvent;
  12.    
  13.    public class OWIntro extends OWindow
  14.    {
  15.       
  16.       public static var stHide:int = 6;
  17.       
  18.       public static var stNormal:int = 5;
  19.       
  20.       public static var stShowName:int = 4;
  21.       
  22.       public static var stShowHeader:int = 2;
  23.       
  24.       public static var stInvisible:int = 7;
  25.       
  26.       public static var stShowLogo:int = 1;
  27.       
  28.       public static var stShowFooter:int = 3;
  29.       
  30.       public static var stBeforeShow:int = 0;
  31.        
  32.       
  33.       public var iGameName:OIObject;
  34.       
  35.       public var iHeader:OBitmap;
  36.       
  37.       private var iTimer:Number;
  38.       
  39.       public var iHit:OSprite;
  40.       
  41.       public var iFooter:OBitmap;
  42.       
  43.       private var iAlpha:Array;
  44.       
  45.       private var iLogo:OWLogo;
  46.       
  47.       public function OWIntro()
  48.       {
  49.          ClusterzL.OWIntroParam[0][1] = [[ODisplay.SpriteRect,800 * OGlobal.Scale,600 * OGlobal.Scale]];
  50.          super(ClusterzL.OWIntroParam);
  51.       }
  52.       
  53.       override public function Init() : void
  54.       {
  55.          var _loc1_:int = 0;
  56.          var _loc2_:int = 0;
  57.          var _loc3_:DisplayObject = null;
  58.          super.Init();
  59.          this.iHeader.alpha = 0;
  60.          this.iFooter.alpha = 0;
  61.          this.iGameName.prY = 320 - this.iGameName.prHeight / 2;
  62.          _loc1_ = this.iGameName.numChildren;
  63.          this.iAlpha = new Array(_loc1_);
  64.          _loc2_ = 0;
  65.          while(_loc2_ < _loc1_)
  66.          {
  67.             _loc3_ = this.iGameName.getChildAt(_loc2_);
  68.             _loc3_.alpha = 0;
  69.             this.iAlpha[_loc2_] = -_loc2_ * 0.3;
  70.             _loc2_++;
  71.          }
  72.          this.hitArea = this.iHit;
  73.          iLogo = new OWLogo();
  74.          iLogo.SetVisible(false);
  75.          this.addChild(iLogo);
  76.          this.State = stBeforeShow;
  77.       }
  78.       
  79.       override public function Free() : void
  80.       {
  81.          super.Free();
  82.          this.iHeader = null;
  83.          this.iFooter = null;
  84.       }
  85.       
  86.       override public function OnMouseDown(param1:MouseEvent) : void
  87.       {
  88.          if(this.iState < OWIntro.stShowFooter)
  89.          {
  90.             return;
  91.          }
  92.          this.prVisible = false;
  93.          super.OnMouseDown(param1);
  94.       }
  95.       
  96.       override public function OnEnterFrame(param1:Event) : void
  97.       {
  98.          var _loc2_:int = 0;
  99.          switch(this.iState)
  100.          {
  101.             case stBeforeShow:
  102.                if(this.iTimer-- <= 0)
  103.                {
  104.                   this.State = stShowLogo;
  105.                }
  106.                break;
  107.             case stShowLogo:
  108.                if(this.iTimer-- <= 0)
  109.                {
  110.                   this.State = stShowHeader;
  111.                }
  112.                break;
  113.             case stShowHeader:
  114.                if(this.iHeader.alpha >= 1)
  115.                {
  116.                   this.iHeader.alpha = 1;
  117.                   this.State = stShowFooter;
  118.                }
  119.                else
  120.                {
  121.                   this.iHeader.alpha += 0.025;
  122.                }
  123.                break;
  124.             case stShowFooter:
  125.                if(this.iFooter.alpha >= 1)
  126.                {
  127.                   this.iFooter.alpha = 1;
  128.                   this.State = stShowName;
  129.                }
  130.                else
  131.                {
  132.                   this.iFooter.alpha += 0.025;
  133.                }
  134.                break;
  135.             case stShowName:
  136.                if(this.iGameName.getChildAt(this.iGameName.numChildren - 1).alpha >= 1)
  137.                {
  138.                   this.State = stNormal;
  139.                }
  140.                else
  141.                {
  142.                   _loc2_ = 0;
  143.                   while(_loc2_ < this.iGameName.numChildren)
  144.                   {
  145.                      this.iAlpha[_loc2_] += 0.025;
  146.                      if(this.iAlpha[_loc2_] > 1)
  147.                      {
  148.                         this.iAlpha[_loc2_] = 1;
  149.                      }
  150.                      if(this.iAlpha[_loc2_] >= 0)
  151.                      {
  152.                         this.iGameName.getChildAt(_loc2_).alpha = this.iAlpha[_loc2_];
  153.                      }
  154.                      _loc2_++;
  155.                   }
  156.                }
  157.                break;
  158.             case stNormal:
  159.                if(this.iTimer-- <= 0)
  160.                {
  161.                   this.State = stHide;
  162.                }
  163.                break;
  164.             case stHide:
  165.                if(this.iFooter.alpha <= 0)
  166.                {
  167.                   this.State = stInvisible;
  168.                }
  169.                else
  170.                {
  171.                   this.iHeader.alpha -= 0.05;
  172.                   this.iFooter.alpha -= 0.05;
  173.                   this.iGameName.alpha -= 0.05;
  174.                }
  175.          }
  176.       }
  177.       
  178.       override public function set State(param1:int) : void
  179.       {
  180.          this.iState = param1;
  181.          switch(this.iState)
  182.          {
  183.             case stShowLogo:
  184.                iLogo.scaleX = OGlobal.Scale;
  185.                iLogo.scaleY = OGlobal.Scale;
  186.                iLogo.prVisible = true;
  187.                this.iTimer = 105;
  188.                break;
  189.             case stShowHeader:
  190.                iLogo.prVisible = false;
  191.                break;
  192.             case stBeforeShow:
  193.                this.iTimer = 20;
  194.                break;
  195.             case stNormal:
  196.                this.iTimer = 180;
  197.                break;
  198.             case stInvisible:
  199.                this.prVisible = false;
  200.          }
  201.       }
  202.    }
  203. }
  204.