home *** CD-ROM | disk | FTP | other *** search
- package com.livebrush.ui
- {
- import com.livebrush.styles.LineStyle;
- import flash.events.Event;
- import flash.events.MouseEvent;
-
- public class BrushBehaveController extends UIController
- {
- public function BrushBehaveController(brushBehaveView:BrushBehaveView)
- {
- super(brushBehaveView);
- this.init();
- }
-
- override protected function init() : void
- {
- this.uiAsset.behaveTypes.addEventListener(Event.CHANGE,this.openInputSWF);
- registerTypeControl(this.uiAsset.behaveTypes,BrushBehaveView.INPUT_TYPES,this.propsChangeEvent);
- registerSliderControl(this.uiAsset.velocityInput,this.propsChangeEvent,"Velocity");
- registerSliderControl(this.uiAsset.frictionInput,this.propsChangeEvent,"Friction");
- this.uiAsset.addEventListener(Event.CHANGE,this.propsChangeEvent);
- this.uiAsset.addEventListener(MouseEvent.CLICK,this.mouseEvent);
- }
-
- private function get brushBehaveView() : BrushBehaveView
- {
- return BrushBehaveView(view);
- }
-
- private function get brushPropsModel() : BrushPropsModel
- {
- return this.brushBehaveView.brushPropsModel;
- }
-
- private function mouseEvent(e:MouseEvent) : void
- {
- switch(e.target.name)
- {
- case "loadInputBtn":
- ui.main.importInputSWF();
- }
- }
-
- private function openInputSWF(e:Event = null) : void
- {
- if(this.uiAsset.behaveTypes.selectedItem.data == LineStyle.DYNAMIC && this.uiAsset._dynamicFile.text == "")
- {
- ui.main.importInputSWF();
- }
- }
-
- private function propsChangeEvent(e:Event) : void
- {
- e.stopImmediatePropagation();
- this.brushBehaveView.applyProps();
- this.brushPropsModel.pullStyleProps();
- }
-
- private function get uiAsset() : Object
- {
- return this.brushBehaveView.uiAsset;
- }
- }
- }
-
-