home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / animal_artist.swf / scripts / Gamefile / GameChina.as < prev    next >
Encoding:
Text File  |  2008-09-05  |  1.7 KB  |  73 lines

  1. package Gamefile
  2. {
  3.    import flash.display.MovieClip;
  4.    import flash.events.Event;
  5.    import flash.events.MouseEvent;
  6.    import flash.net.URLRequest;
  7.    import flash.net.navigateToURL;
  8.    
  9.    public class GameChina
  10.    {
  11.        
  12.       
  13.       private var PARENT:MovieClip;
  14.       
  15.       private var mc:MovieClip;
  16.       
  17.       public function GameChina(param1:MovieClip)
  18.       {
  19.          super();
  20.          trace("GameChina");
  21.          PARENT = param1;
  22.          initMc();
  23.          initEvent();
  24.       }
  25.       
  26.       private function clickMc(param1:MouseEvent) : void
  27.       {
  28.          navigateToURL(new URLRequest("http://www.game.com.cn/"),"_blank");
  29.       }
  30.       
  31.       private function initMc() : void
  32.       {
  33.          mc = new _ChinaGame_();
  34.          trace(mc);
  35.          PARENT.addChild(mc);
  36.          mc.x = 320;
  37.          mc.y = 240;
  38.       }
  39.       
  40.       private function delMc() : void
  41.       {
  42.          PARENT.removeChild(mc);
  43.       }
  44.       
  45.       private function initEvent() : void
  46.       {
  47.          mc.addEventListener(MouseEvent.CLICK,clickMc);
  48.          mc.addEventListener(Event.ENTER_FRAME,enterFrameMc);
  49.       }
  50.       
  51.       public function del() : void
  52.       {
  53.          delEvent();
  54.          delMc();
  55.       }
  56.       
  57.       private function enterFrameMc(param1:Event) : void
  58.       {
  59.          if(mc.totalFrames == mc.currentFrame)
  60.          {
  61.             trace("showGameStart");
  62.             PARENT.dispatchEvent(new Event("showGameStart",true));
  63.          }
  64.       }
  65.       
  66.       private function delEvent() : void
  67.       {
  68.          mc.removeEventListener(Event.ENTER_FRAME,enterFrameMc);
  69.          mc.removeEventListener(MouseEvent.CLICK,clickMc);
  70.       }
  71.    }
  72. }
  73.