home *** CD-ROM | disk | FTP | other *** search
- package com.livebrush.ui
- {
- import flash.events.Event;
- import flash.events.MouseEvent;
-
- public class BasicWindowController extends UIController
- {
- public function BasicWindowController(basicWindowView:BasicWindowView)
- {
- super(basicWindowView);
- this.init();
- }
-
- override protected function init() : void
- {
- this.uiAsset.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.addEventListener(MouseEvent.CLICK,this.mouseEvent);
- this.panelAsset.addEventListener(MouseEvent.MOUSE_DOWN,this.panelMouseEvent);
- this.panelAsset.addEventListener(MouseEvent.MOUSE_UP,this.panelMouseEvent);
- }
-
- private function propsChangeEvent(e:Event) : void
- {
- }
-
- private function get basicWindowView() : BasicWindowView
- {
- return BasicWindowView(view);
- }
-
- private function mouseEvent(e:MouseEvent) : void
- {
- switch(e.target.name)
- {
- case "closeBtn":
- ui.closeWindow(this.basicWindowView);
- }
- }
-
- override public function die() : void
- {
- this.panelAsset.stopDrag();
- this.uiAsset.removeEventListener(MouseEvent.CLICK,this.mouseEvent);
- this.uiAsset.removeEventListener(Event.CHANGE,this.propsChangeEvent);
- this.panelAsset.removeEventListener(MouseEvent.MOUSE_DOWN,this.panelMouseEvent);
- this.panelAsset.removeEventListener(MouseEvent.MOUSE_UP,this.panelMouseEvent);
- }
-
- private function panelMouseEvent(e:MouseEvent) : void
- {
- if(e.type == MouseEvent.MOUSE_DOWN && e.target.name == "titleBtn" && this.basicWindowView.enableDrag)
- {
- this.panelAsset.startDrag();
- }
- else if(e.type == MouseEvent.MOUSE_UP && e.target.name == "titleBtn" && this.basicWindowView.enableDrag)
- {
- this.panelAsset.stopDrag();
- }
- }
-
- private function get panelAsset() : Object
- {
- return this.basicWindowView.panelAsset;
- }
-
- private function get uiAsset() : BasicWindowUI
- {
- return this.basicWindowView.uiAsset;
- }
- }
- }
-
-