home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / Frizzle_fraz.swf / scripts / Code / WINDOWS / _gk231.as < prev    next >
Encoding:
Text File  |  2008-09-26  |  13.3 KB  |  386 lines

  1. package Code.WINDOWS
  2. {
  3.    import Code.LIB.MOCHIADS._gw127;
  4.    import Code.LIB._bm350;
  5.    import Code.LIB._bm468;
  6.    import Code.LIB._ei76;
  7.    import Code.LIB._hu299;
  8.    import Code.LIB._iv163;
  9.    import Code.LIB._lx496;
  10.    import Code.LIB._na237;
  11.    import Code.LIB._nx518;
  12.    import Code.LIB._pw224;
  13.    import Code.LIB._uu24;
  14.    import Code.LOGIC._cd449;
  15.    import Code.OPTIONS._dx111;
  16.    import Code.OPTIONS._ea490;
  17.    import Code.WINDOWS.DIALOGS._ra85;
  18.    import Code._vy402;
  19.    import flash.display.MovieClip;
  20.    import flash.display.Sprite;
  21.    import flash.events.Event;
  22.    import flash.events.KeyboardEvent;
  23.    import flash.events.MouseEvent;
  24.    import flash.utils.getTimer;
  25.    
  26.    public class _gk231 extends _ei76
  27.    {
  28.       
  29.       public static const stLevel:int = 3;
  30.       
  31.       public static const stInvisible:int = 8;
  32.       
  33.       public static const stPlay:int = 4;
  34.       
  35.       public static const stCompleteAllLevels:int = 7;
  36.       
  37.       public static const stComplete:int = 5;
  38.       
  39.       public static const stLoose:int = 6;
  40.       
  41.       public static const stShow:int = 0;
  42.        
  43.       
  44.       public var pause:_nx518;
  45.       
  46.       private var msgs:Array;
  47.       
  48.       public var iLevelLabel:_pw224;
  49.       
  50.       private var iField:_cd449;
  51.       
  52.       public var menuBig:_nx518;
  53.       
  54.       public var menu:_nx518;
  55.       
  56.       private var allLevels:Boolean = false;
  57.       
  58.       public var iMenu:_nx518;
  59.       
  60.       public var submitScore:_nx518;
  61.       
  62.       private var iMsgLabel:_pw224;
  63.       
  64.       private var submitDialog:_ra85;
  65.       
  66.       public var iMore:_nx518;
  67.       
  68.       public var playAgain:_nx518;
  69.       
  70.       private var score:_bm468;
  71.       
  72.       private var iWFinished:MovieClip;
  73.       
  74.       public var retry:_nx518;
  75.       
  76.       private var iState:int;
  77.       
  78.       public var biba:_pw224;
  79.       
  80.       public var nextLevel:_nx518;
  81.       
  82.       private var iPaused:Boolean = false;
  83.       
  84.       public function _gk231()
  85.       {
  86.          var _loc1_:Array = null;
  87.          iPaused = false;
  88.          allLevels = false;
  89.          _loc1_ = [[_vy402._jk562,"next level",_dx111.cAqua,220,70,21,_dx111.cWhite,80,510,"nextLevel",false],[_vy402._jk562,"submit score",_dx111.cAqua,220,70,21,_dx111.cWhite,469,510,"submitScore",false],[_vy402._jk562,"retry",_dx111.cAqua,220,70,21,_dx111.cWhite,300,390,"retry",false],[_vy402._jk562,"menu",_dx111.cAqua,220,70,21,_dx111.cWhite,595,520,"menuBig",false],[_vy402._jk562,"play again",_dx111.cAqua,220,70,21,_dx111.cWhite,370,542,"playAgain",false],[_vy402._rd64,"pause",_dx111.cAqua,63,30,13,_dx111.cWhite,240,3,"pause",false],[_vy402._rd64,"menu",_dx111.cAqua,60,30,13,_dx111.cWhite,315,3,"menu",false]];
  90.          super(_loc1_);
  91.          score = new _bm468(20,_dx111.cWhite,"score");
  92.          score.alpha = 0.8;
  93.          score._oa54 = 0;
  94.          score.visible = false;
  95.          score._lh238 = 570;
  96.          addChild(score);
  97.          biba = new _pw224(19,_dx111.cWhite,null);
  98.          biba._gm53(610,570);
  99.          biba.Text = "bibagames.com";
  100.          biba.alpha = 0.8;
  101.          biba.visible = false;
  102.          addChild(biba);
  103.          _nk262();
  104.       }
  105.       
  106.       override public function _vx267(param1:KeyboardEvent) : void
  107.       {
  108.          if(Boolean(iField) && iField.paused)
  109.          {
  110.             _rr336(false);
  111.          }
  112.       }
  113.       
  114.       private function _rr336(param1:Boolean) : void
  115.       {
  116.          iField.paused = param1;
  117.          if(param1 == true)
  118.          {
  119.             this.iMsgLabel.Text = "game paused\n press any key to continue!";
  120.             this.iMsgLabel._gm53((800 - this.iMsgLabel.width) / 2,(500 - this.iMsgLabel.height) / 2);
  121.          }
  122.          else
  123.          {
  124.             this.iMsgLabel.Text = "";
  125.          }
  126.       }
  127.       
  128.       override public function onEnterFrame(param1:Event) : void
  129.       {
  130.          var _loc2_:int = 0;
  131.          var _loc3_:int = 0;
  132.          var _loc4_:_iv163 = null;
  133.          super.onEnterFrame(param1);
  134.          if(this.iPaused)
  135.          {
  136.             return;
  137.          }
  138.          _loc2_ = getTimer();
  139.          switch(this.iState)
  140.          {
  141.             case stShow:
  142.                if(!this._mf556 && this._rm382)
  143.                {
  144.                   this.State = stLevel;
  145.                }
  146.                break;
  147.             case stLevel:
  148.                if(this.iMsgLabel.alpha < 0.99)
  149.                {
  150.                   this.iMsgLabel.alpha += 0.07;
  151.                }
  152.                if(_loc2_ - this.iITimer > 1500)
  153.                {
  154.                   this.iMsgLabel.Text = "";
  155.                   this.State = stPlay;
  156.                }
  157.                break;
  158.             case stPlay:
  159.                if(iField._sn240 == _cd449.stWin)
  160.                {
  161.                   menu.visible = false;
  162.                   pause.visible = false;
  163.                   State = stComplete;
  164.                }
  165.                else if(iField._sn240 == _cd449.stLoose)
  166.                {
  167.                   menu.visible = false;
  168.                   pause.visible = false;
  169.                   State = stLoose;
  170.                }
  171.                else if(_na237._gt371 + iField._kw428 * 150 != score._oa54)
  172.                {
  173.                   score._oa54 = _na237._gt371 + iField._kw428 * 150;
  174.                }
  175.                break;
  176.             case stComplete:
  177.                _loc3_ = 0;
  178.                while(_loc3_ < msgs.length)
  179.                {
  180.                   if((_loc4_ = msgs[_loc3_]).alpha < 1)
  181.                   {
  182.                      _loc4_.alpha += 0.045;
  183.                      break;
  184.                   }
  185.                   _loc3_++;
  186.                }
  187.                break;
  188.             case stLoose:
  189.          }
  190.       }
  191.       
  192.       public function _lb395(param1:Event) : void
  193.       {
  194.          if(iField && !iField.paused && iState == stPlay)
  195.          {
  196.             _rr336(true);
  197.          }
  198.       }
  199.       
  200.       override public function _lf305(param1:MouseEvent) : void
  201.       {
  202.          var _loc2_:String = null;
  203.          var _loc3_:Sprite = null;
  204.          if(Boolean(submitDialog) && (param1.target == submitDialog.iOk._ol346 || param1.target == submitDialog.iCancel._ol346))
  205.          {
  206.             switch(param1.target)
  207.             {
  208.                case submitDialog.iOk._ol346:
  209.                   _loc2_ = int(_bm350.prStage.stageWidth) + "x" + int(_bm350.prStage.stageHeight);
  210.                   _gw127._mx117({
  211.                      "boardID":"bea313d30c4f0068",
  212.                      "score":_na237._gt371,
  213.                      "res":_loc2_
  214.                   });
  215.                   submitScore.visible = false;
  216.                   _bm350.scoreSubmitted = true;
  217.                   _loc3_ = new Sprite();
  218.                   _loc3_.graphics.beginFill(0,1);
  219.                   _loc3_.graphics.drawRect(448 * _bm350._tc204,460 * _bm350._tc204,300 * _bm350._tc204,120 * _bm350._tc204);
  220.                   _loc3_.graphics.endFill();
  221.                   addChild(_loc3_);
  222.                   break;
  223.                case submitDialog.iCancel._ol346:
  224.             }
  225.             removeChild(submitDialog);
  226.             submitDialog._fy281();
  227.             submitDialog = null;
  228.             return;
  229.          }
  230.          if(submitDialog)
  231.          {
  232.             return;
  233.          }
  234.          if(Boolean(iField) && (param1.target == nextLevel._ol346 || param1.target == retry._ol346 || param1.target == playAgain._ol346))
  235.          {
  236.             (parent as _lx496).menuItem = _dx111.miGame;
  237.             hide();
  238.             State = stInvisible;
  239.          }
  240.          if(Boolean(iField) && param1.target == submitScore._ol346)
  241.          {
  242.             submitDialog = new _ra85("You can submit\nscore only once.\n Are you sure?");
  243.             addChild(submitDialog);
  244.             submitDialog._gm53(150,100);
  245.          }
  246.          if(iState == stPlay && param1.target == menu._ol346)
  247.          {
  248.             (parent as _lx496).menuItem = _dx111.miMenu;
  249.             hide();
  250.          }
  251.          if(iState == stPlay && param1.target == pause._ol346)
  252.          {
  253.             _rr336(!iField.paused);
  254.          }
  255.          if(param1.target == menuBig._ol346)
  256.          {
  257.             (parent as _lx496).menuItem = _dx111.miMenu;
  258.             hide();
  259.          }
  260.       }
  261.       
  262.       public function _nk262() : void
  263.       {
  264.          this.iMsgLabel = new _pw224(40,_dx111.cAqua,_hu299.Bevel);
  265.          this.addChild(this.iMsgLabel);
  266.          this.iMsgLabel.mouseEnabled = false;
  267.          this.addEventListener(Event.DEACTIVATE,_lb395);
  268.       }
  269.       
  270.       private function set State(param1:int) : void
  271.       {
  272.          var _loc2_:Class = null;
  273.          var _loc3_:MovieClip = null;
  274.          var _loc4_:int = 0;
  275.          var _loc5_:_iv163 = null;
  276.          var _loc6_:Sprite = null;
  277.          this.iState = param1;
  278.          switch(this.iState)
  279.          {
  280.             case stShow:
  281.                break;
  282.             case stLevel:
  283.                if(_na237._wd393 >= _ea490.Levels.length)
  284.                {
  285.                   _bm350.scoreSubmitted = false;
  286.                   _na237._wm168();
  287.                }
  288.                this.iMsgLabel.Color = _dx111.cWhite;
  289.                this.iMsgLabel._yy538 = 40;
  290.                this.iMsgLabel.Text = "         " + _dx111.iLanguage.strLevel + " # " + (_na237._wd393 + 1).toString() + "/" + _ea490.Levels.length;
  291.                this.iMsgLabel._gm53((500 - this.iMsgLabel.width) / 2,(600 - this.iMsgLabel.height) / 2);
  292.                this.iMsgLabel.alpha = 0;
  293.                this.iITimer = getTimer();
  294.                break;
  295.             case stPlay:
  296.                pause.visible = true;
  297.                menu.visible = true;
  298.                score.visible = true;
  299.                biba.visible = true;
  300.                this.iField = new _cd449(_ea490.Levels[_na237._wd393]);
  301.                this.addChildAt(iField,0);
  302.                break;
  303.             case stComplete:
  304.                _na237._gk216();
  305.                if(_na237._wd393 >= _ea490.Levels.length)
  306.                {
  307.                   allLevels = true;
  308.                   submitScore._vt351 = 93;
  309.                   submitScore._lh238 = 544;
  310.                   playAgain.visible = true;
  311.                }
  312.                msgs = new Array();
  313.                this.iMsgLabel._vt351 = 200;
  314.                this.iMsgLabel._lh238 = 10;
  315.                this.iMsgLabel.Text = allLevels == true ? "Congratulations!\nYou have completed\nall levels!" : "great, level completed!";
  316.                msgs.push(_uu24._ec508(iMsgLabel));
  317.                this.iMsgLabel.Color = _dx111.cGreen;
  318.                this.iMsgLabel._lh238 = 100;
  319.                this.iMsgLabel.Text = "Little Frizzles: " + int(this.iField._kw428);
  320.                msgs.push(_uu24._ec508(iMsgLabel));
  321.                this.iMsgLabel.Color = _dx111.cRed;
  322.                this.iMsgLabel.Text = "score: " + this.iField._kw428 * 150;
  323.                msgs.push(_uu24._ec508(iMsgLabel));
  324.                _na237._ym248(this.iField._kw428 * 150);
  325.                this.iMsgLabel.Color = _dx111.cAquaLight;
  326.                this.iMsgLabel.Text = "total score: " + _na237._gt371;
  327.                msgs.push(_uu24._ec508(iMsgLabel));
  328.                _loc4_ = 0;
  329.                while(_loc4_ < msgs.length)
  330.                {
  331.                   (_loc5_ = msgs[_loc4_])._lh238 = _loc4_ * 60;
  332.                   _loc5_.alpha = 0;
  333.                   addChild(_loc5_);
  334.                   _loc4_++;
  335.                }
  336.                _loc2_ = allLevels ? _dx111.TWComplete : _dx111.GWWin;
  337.                _loc3_ = new _loc2_() as MovieClip;
  338.                _loc3_.scaleX = _loc3_.scaleY = _bm350._tc204;
  339.                addChild(_loc3_);
  340.                addChild(nextLevel);
  341.                addChild(submitScore);
  342.                addChild(playAgain);
  343.                nextLevel.visible = !allLevels;
  344.                submitScore.visible = !_bm350.scoreSubmitted;
  345.                if(!submitScore.visible)
  346.                {
  347.                   (_loc6_ = new Sprite()).graphics.beginFill(0,1);
  348.                   _loc6_.graphics.drawRect(448 * _bm350._tc204,460 * _bm350._tc204,300 * _bm350._tc204,120 * _bm350._tc204);
  349.                   _loc6_.graphics.endFill();
  350.                   addChild(_loc6_);
  351.                }
  352.                break;
  353.             case stLoose:
  354.                this.iMsgLabel.Text = "level failed,\n try again!";
  355.                this.iMsgLabel._gm53((800 - this.iMsgLabel.width) / 2,140);
  356.                this.iMsgLabel.visible = true;
  357.                _loc3_ = new _dx111.GWGameOver() as MovieClip;
  358.                _loc3_.scaleX = _loc3_.scaleY = _bm350._tc204;
  359.                addChild(_loc3_);
  360.                addChild(menuBig);
  361.                addChild(retry);
  362.                addChild(this.iMsgLabel);
  363.                menuBig.visible = true;
  364.                retry.visible = true;
  365.                break;
  366.             case stCompleteAllLevels:
  367.                iWFinished = new _dx111.TWComplete() as MovieClip;
  368.                iWFinished.scaleX = iWFinished.scaleY = _bm350._tc204;
  369.                iWFinished.x = (800 - 400) / 2 * _bm350._tc204;
  370.                iWFinished.y = (600 - 400) / 2 * _bm350._tc204;
  371.                addChild(iWFinished);
  372.          }
  373.       }
  374.       
  375.       override public function _fy281() : void
  376.       {
  377.          super._fy281();
  378.          if(this.iField)
  379.          {
  380.             this.iField._fy281();
  381.          }
  382.          this.removeEventListener(Event.DEACTIVATE,_lb395);
  383.       }
  384.    }
  385. }
  386.