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 / BrushBehaveController.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  2.0 KB  |  66 lines

  1. package com.livebrush.ui
  2. {
  3.    import com.livebrush.styles.LineStyle;
  4.    import flash.events.Event;
  5.    import flash.events.MouseEvent;
  6.    
  7.    public class BrushBehaveController extends UIController
  8.    {
  9.       public function BrushBehaveController(brushBehaveView:BrushBehaveView)
  10.       {
  11.          super(brushBehaveView);
  12.          this.init();
  13.       }
  14.       
  15.       override protected function init() : void
  16.       {
  17.          this.uiAsset.behaveTypes.addEventListener(Event.CHANGE,this.openInputSWF);
  18.          registerTypeControl(this.uiAsset.behaveTypes,BrushBehaveView.INPUT_TYPES,this.propsChangeEvent);
  19.          registerSliderControl(this.uiAsset.velocityInput,this.propsChangeEvent,"Velocity");
  20.          registerSliderControl(this.uiAsset.frictionInput,this.propsChangeEvent,"Friction");
  21.          this.uiAsset.addEventListener(Event.CHANGE,this.propsChangeEvent);
  22.          this.uiAsset.addEventListener(MouseEvent.CLICK,this.mouseEvent);
  23.       }
  24.       
  25.       private function get brushBehaveView() : BrushBehaveView
  26.       {
  27.          return BrushBehaveView(view);
  28.       }
  29.       
  30.       private function get brushPropsModel() : BrushPropsModel
  31.       {
  32.          return this.brushBehaveView.brushPropsModel;
  33.       }
  34.       
  35.       private function mouseEvent(e:MouseEvent) : void
  36.       {
  37.          switch(e.target.name)
  38.          {
  39.             case "loadInputBtn":
  40.                ui.main.importInputSWF();
  41.          }
  42.       }
  43.       
  44.       private function openInputSWF(e:Event = null) : void
  45.       {
  46.          if(this.uiAsset.behaveTypes.selectedItem.data == LineStyle.DYNAMIC && this.uiAsset._dynamicFile.text == "")
  47.          {
  48.             ui.main.importInputSWF();
  49.          }
  50.       }
  51.       
  52.       private function propsChangeEvent(e:Event) : void
  53.       {
  54.          e.stopImmediatePropagation();
  55.          this.brushBehaveView.applyProps();
  56.          this.brushPropsModel.pullStyleProps();
  57.       }
  58.       
  59.       private function get uiAsset() : Object
  60.       {
  61.          return this.brushBehaveView.uiAsset;
  62.       }
  63.    }
  64. }
  65.  
  66.