home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / kung_fu.swf / scripts / __Packages / com / KidFighting / SelectCharacterGUI.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  4.8 KB  |  101 lines

  1. class com.KidFighting.SelectCharacterGUI extends MovieClip
  2. {
  3.    static var addEventListener;
  4.    static var _mc;
  5.    static var dispatchEvent;
  6.    static var _evt = mx.events.EventDispatcher.initialize(com.KidFighting.SelectCharacterGUI);
  7.    static var delay_timer = new ds.controls.Timer();
  8.    static var selected_char_id = -1;
  9.    static var selected_enemy_id = -1;
  10.    function SelectCharacterGUI()
  11.    {
  12.       super();
  13.       com.KidFighting.SelectCharacterGUI._mc = this;
  14.       com.KidFighting.SelectCharacterGUI.delay_timer.func = mx.utils.Delegate.create(com.KidFighting.SelectCharacterGUI,com.KidFighting.SelectCharacterGUI.onSelectedEnemy);
  15.       com.KidFighting.SelectCharacterGUI.delay_timer.interval = 4000;
  16.    }
  17.    static function reset()
  18.    {
  19.       var _loc1_ = com.KidFighting.SelectCharacterGUI._mc;
  20.       com.KidFighting.SelectCharacterGUI.selected_char_id = -1;
  21.       com.KidFighting.SelectCharacterGUI.selected_enemy_id = -1;
  22.       _loc1_._visible = true;
  23.       _loc1_.gotoAndStop(1);
  24.       com.KidFighting.SelectCharacterGUI._mc.c1.gotoAndStop(2);
  25.       _loc1_.s1.onRelease = function()
  26.       {
  27.          com.KidFighting.SelectCharacterGUI.selected_char_id = 0;
  28.          com.KidFighting.SelectCharacterGUI.selectPlayer();
  29.          ds.controls.SoundPlayer.playSound("vSelectCharector");
  30.       };
  31.       _loc1_.s2.onRelease = function()
  32.       {
  33.          com.KidFighting.SelectCharacterGUI.selected_char_id = 1;
  34.          com.KidFighting.SelectCharacterGUI.selectPlayer();
  35.          ds.controls.SoundPlayer.playSound("vSelectCharector");
  36.       };
  37.       _loc1_.s1.onRollOver = function()
  38.       {
  39.          com.KidFighting.SelectCharacterGUI._mc.c1.gotoAndStop(2);
  40.          com.KidFighting.SelectCharacterGUI._mc.c2.gotoAndStop(1);
  41.          if(com.KidFighting.SelectCharacterGUI._mc.c2.getDepth() > com.KidFighting.SelectCharacterGUI._mc.c1.getDepth())
  42.          {
  43.             ds.controls.SoundPlayer.playSound("charectorOn");
  44.             com.KidFighting.SelectCharacterGUI._mc.c2.swapDepths(com.KidFighting.SelectCharacterGUI._mc.c1);
  45.          }
  46.       };
  47.       _loc1_.s2.onRollOver = function()
  48.       {
  49.          com.KidFighting.SelectCharacterGUI._mc.c1.gotoAndStop(1);
  50.          com.KidFighting.SelectCharacterGUI._mc.c2.gotoAndStop(2);
  51.          if(com.KidFighting.SelectCharacterGUI._mc.c2.getDepth() < com.KidFighting.SelectCharacterGUI._mc.c1.getDepth())
  52.          {
  53.             com.KidFighting.SelectCharacterGUI._mc.c2.swapDepths(com.KidFighting.SelectCharacterGUI._mc.c1);
  54.             ds.controls.SoundPlayer.playSound("charectorOn");
  55.          }
  56.       };
  57.    }
  58.    static function selectPlayer()
  59.    {
  60.       com.KidFighting.SelectCharacterGUI._mc.gotoAndStop(2);
  61.       com.KidFighting.SelectCharacterGUI._mc.p1.gotoAndStop(com.KidFighting.SelectCharacterGUI.selected_char_id + 1);
  62.       com.KidFighting.SelectCharacterGUI._mc.p1Name_txt.gotoAndStop(com.KidFighting.SelectCharacterGUI.selected_char_id + 1);
  63.       com.KidFighting.SelectCharacterGUI.dispatchEvent({type:"selectPlayer",id:com.KidFighting.SelectCharacterGUI.selected_char_id});
  64.       com.KidFighting.SelectCharacterGUI.selectNextPlayer();
  65.    }
  66.    static function selectNextPlayer()
  67.    {
  68.       if(com.KidFighting.SelectCharacterGUI.selected_enemy_id != -1)
  69.       {
  70.          if(com.KidFighting.SelectCharacterGUI.selected_enemy_id < 6)
  71.          {
  72.             com.KidFighting.SelectCharacterGUI._mc.avator_mc["a" + (com.KidFighting.SelectCharacterGUI.selected_enemy_id + 1)].gotoAndStop(2);
  73.          }
  74.          else
  75.          {
  76.             com.KidFighting.SelectCharacterGUI._mc.avator_mc["a" + (com.KidFighting.SelectCharacterGUI.selected_enemy_id + 1)].gotoAndStop(3);
  77.          }
  78.       }
  79.       com.KidFighting.SelectCharacterGUI.selected_enemy_id = com.KidFighting.SelectCharacterGUI.selected_enemy_id + 1;
  80.       if(com.KidFighting.SelectCharacterGUI.selected_enemy_id > 5)
  81.       {
  82.          com.KidFighting.SelectCharacterGUI._mc.avator_mc["a" + (com.KidFighting.SelectCharacterGUI.selected_enemy_id + 1)].gotoAndStop(2);
  83.       }
  84.       com.KidFighting.SelectCharacterGUI._mc.p2.gotoAndStop(3 + com.KidFighting.SelectCharacterGUI.selected_enemy_id);
  85.       com.KidFighting.SelectCharacterGUI._mc.p2Name_txt.gotoAndStop(3 + com.KidFighting.SelectCharacterGUI.selected_enemy_id);
  86.       com.KidFighting.SelectCharacterGUI._mc._visible = true;
  87.       com.KidFighting.SelectCharacterGUI._mc.avator_mc.gotoAndPlay(2);
  88.       com.KidFighting.SelectCharacterGUI.delay_timer.start();
  89.    }
  90.    static function onSelectedEnemy()
  91.    {
  92.       com.KidFighting.SelectCharacterGUI.delay_timer.stop();
  93.       com.KidFighting.SelectCharacterGUI.dispatchEvent({type:"selectEnemy",id:com.KidFighting.SelectCharacterGUI.selected_enemy_id});
  94.       com.KidFighting.SelectCharacterGUI._mc._visible = false;
  95.    }
  96.    static function onRoundCleared()
  97.    {
  98.       com.KidFighting.SelectCharacterGUI.selectNextPlayer();
  99.    }
  100. }
  101.