package ui
{
   import flash.display.Bitmap;
   import flash.display.Sprite;
   import flash.display.DisplayObjectContainer;
   import flash.events.MouseEvent;
   import flash.geom.Rectangle;
   import flash.geom.Point;
   
   public class About extends Object
   {
      
      public function About(start:Function)
      {
         super();
         this.startArea.addChild(new Bitmap(GameUI.btnAreaSrc2));
         this.startFunc = start;
         this.visible = false;
      }
      
      private static var AboutBmp:Class = About_AboutBmp;
      
      public const dpo:Bitmap = new Bitmap();
      
      private var startFunc:Function;
      
      private const startArea:Sprite = new Sprite();
      
      public function showAs(dpoc:DisplayObjectContainer) : void
      {
         dpoc.addChild(this.dpo);
         dpoc.addChild(this.startArea);
         this.startArea.y = 394;
         this.startArea.x = 31;
         this.startArea.alpha = 0;
         this.startArea.addEventListener(MouseEvent.MOUSE_DOWN,this.mosueDown);
         this.startArea.addEventListener(MouseEvent.MOUSE_UP,this.start);
      }
      
      public function set visible(value:Boolean) : void
      {
         this.startArea.visible = this.dpo.visible = value;
         if(value)
         {
            this.dpo.bitmapData = new GameUI.Panel().bitmapData;
            this.dpo.bitmapData.copyPixels(new AboutBmp().bitmapData,new Rectangle(0,0,800,480),new Point(),null,null,true);
         }
         else if(this.dpo.bitmapData != null)
         {
            this.dpo.bitmapData.dispose();
         }
         
      }
      
      private function mosueDown(e:MouseEvent) : void
      {
         e.target.alpha = 0.3;
      }
      
      private function start(e:MouseEvent) : void
      {
         this.dpo.visible = false;
         this.startArea.alpha = 0;
         this.startArea.visible = false;
         this.startFunc();
      }
   }
}
