home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / Livebrush / Install-LivebrushLite.air / livebrush.swf / scripts / com / livebrush / ui / DialogController.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  2.2 KB  |  77 lines

  1. package com.livebrush.ui
  2. {
  3.    import flash.events.MouseEvent;
  4.    
  5.    public class DialogController extends UIController
  6.    {
  7.       public function DialogController(dialogView:DialogView)
  8.       {
  9.          super(dialogView);
  10.          this.init();
  11.       }
  12.       
  13.       override protected function init() : void
  14.       {
  15.          this.uiAsset.addEventListener(MouseEvent.CLICK,this.mouseEvent);
  16.          this.panelAsset.addEventListener(MouseEvent.MOUSE_DOWN,this.panelMouseEvent);
  17.          this.panelAsset.addEventListener(MouseEvent.MOUSE_UP,this.panelMouseEvent);
  18.       }
  19.       
  20.       private function get dialogModel() : Dialog
  21.       {
  22.          return this.dialogView.dialogModel;
  23.       }
  24.       
  25.       private function mouseEvent(e:MouseEvent) : void
  26.       {
  27.          switch(e.target.name)
  28.          {
  29.             case "yesBtn":
  30.                this.dialogModel.yesAction();
  31.                break;
  32.             case "noBtn":
  33.                this.dialogModel.noAction();
  34.                break;
  35.             case "saveBtn":
  36.             case "styleBtn":
  37.          }
  38.       }
  39.       
  40.       override public function die() : void
  41.       {
  42.          this.panelAsset.stopDrag();
  43.          this.uiAsset.removeEventListener(MouseEvent.CLICK,this.mouseEvent);
  44.          this.panelAsset.removeEventListener(MouseEvent.MOUSE_DOWN,this.panelMouseEvent);
  45.          this.panelAsset.removeEventListener(MouseEvent.MOUSE_UP,this.panelMouseEvent);
  46.       }
  47.       
  48.       private function panelMouseEvent(e:MouseEvent) : void
  49.       {
  50.          if(e.type == MouseEvent.MOUSE_DOWN && e.target.name == "titleBtn" && this.dialogView.enableDrag)
  51.          {
  52.             this.panelAsset.startDrag();
  53.          }
  54.          else if(e.type == MouseEvent.MOUSE_UP && e.target.name == "titleBtn" && this.dialogView.enableDrag)
  55.          {
  56.             this.panelAsset.stopDrag();
  57.          }
  58.       }
  59.       
  60.       private function get panelAsset() : Object
  61.       {
  62.          return this.dialogView.panelAsset;
  63.       }
  64.       
  65.       private function get uiAsset() : Object
  66.       {
  67.          return this.dialogView.uiAsset;
  68.       }
  69.       
  70.       private function get dialogView() : DialogView
  71.       {
  72.          return DialogView(view);
  73.       }
  74.    }
  75. }
  76.  
  77.