home *** CD-ROM | disk | FTP | other *** search
- package com.livebrush.ui
- {
- import flash.events.MouseEvent;
-
- public class DialogController extends UIController
- {
- public function DialogController(dialogView:DialogView)
- {
- super(dialogView);
- this.init();
- }
-
- override protected function init() : void
- {
- 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 get dialogModel() : Dialog
- {
- return this.dialogView.dialogModel;
- }
-
- private function mouseEvent(e:MouseEvent) : void
- {
- switch(e.target.name)
- {
- case "yesBtn":
- this.dialogModel.yesAction();
- break;
- case "noBtn":
- this.dialogModel.noAction();
- break;
- case "saveBtn":
- case "styleBtn":
- }
- }
-
- override public function die() : void
- {
- this.panelAsset.stopDrag();
- this.uiAsset.removeEventListener(MouseEvent.CLICK,this.mouseEvent);
- 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.dialogView.enableDrag)
- {
- this.panelAsset.startDrag();
- }
- else if(e.type == MouseEvent.MOUSE_UP && e.target.name == "titleBtn" && this.dialogView.enableDrag)
- {
- this.panelAsset.stopDrag();
- }
- }
-
- private function get panelAsset() : Object
- {
- return this.dialogView.panelAsset;
- }
-
- private function get uiAsset() : Object
- {
- return this.dialogView.uiAsset;
- }
-
- private function get dialogView() : DialogView
- {
- return DialogView(view);
- }
- }
- }
-
-