home *** CD-ROM | disk | FTP | other *** search
- package com.livebrush.ui
- {
- import com.livebrush.events.ListEvent;
- import com.livebrush.utils.ColorObj;
- import flash.events.Event;
- import flash.events.MouseEvent;
-
- public class LineStyleController extends UIController
- {
- public function LineStyleController(lineStyleView:LineStyleView)
- {
- super(lineStyleView);
- this.init();
- }
-
- override protected function init() : void
- {
- this.uiAsset.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.lineType.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.strokeInputs.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.widthInputs.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.angleInputs.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.alphaInputs.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.lineStyleView.colorInputs.typeInput.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.lineStyleView.colorInputs.addEventListener(ListEvent.ADD,this.addColor);
- this.lineStyleView.colorInputs.addEventListener(ListEvent.REMOVE,this.removeColor);
- this.lineStyleView.colorInputs.addEventListener(Event.CHANGE,this.propsChangeEvent);
- }
-
- private function get lineStyleView() : LineStyleView
- {
- return LineStyleView(view);
- }
-
- private function mouseEvent(e:MouseEvent) : void
- {
- }
-
- private function addColor(e:ListEvent) : void
- {
- try
- {
- this.lineStyleView.colorInputs.addItemAt(this.lineStyleView.colorInputs.list[this.lineStyleView.colorInputs.selectedIndex].copy(),this.lineStyleView.colorInputs.selectedIndex);
- }
- catch(e:Error)
- {
- lineStyleView.colorInputs.addItemAt(lineStyleView.colorInputs.list[0].copy(),0);
- }
- catch(e:Error)
- {
- lineStyleView.colorInputs.addItemAt(new ColorObj(16711680,true),0);
- }
- }
-
- private function propsChangeEvent(e:Event) : void
- {
- e.stopImmediatePropagation();
- this.lineStyleView.applyProps();
- this.brushPropsModel.pullStyleProps();
- }
-
- private function get brushPropsModel() : BrushPropsModel
- {
- return this.lineStyleView.brushPropsModel;
- }
-
- private function get uiAsset() : Object
- {
- return this.lineStyleView.uiAsset;
- }
-
- private function removeColor(e:ListEvent) : void
- {
- try
- {
- this.lineStyleView.colorInputs.removeItemsAt(this.lineStyleView.colorInputs.selectedIndex,1);
- }
- catch(e:Error)
- {
- lineStyleView.colorInputs.removeItemsAt(0,1);
- }
- }
- }
- }
-
-