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 / BasicWindowController.as next >
Encoding:
Text File  |  2009-10-26  |  2.3 KB  |  73 lines

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