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 / BasicWindowView.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  2.7 KB  |  91 lines

  1. package com.livebrush.ui
  2. {
  3.    import com.livebrush.events.UpdateEvent;
  4.    import com.livebrush.utils.Update;
  5.    import flash.text.TextField;
  6.    
  7.    public class BasicWindowView extends UIView
  8.    {
  9.       public var data:Object;
  10.       
  11.       public var panelAsset:WindowAssetUI;
  12.       
  13.       public var enableDrag:Boolean = true;
  14.       
  15.       public var uiAsset:BasicWindowUI;
  16.       
  17.       public function BasicWindowView(ui:UI, data:Object = null)
  18.       {
  19.          super(ui);
  20.          this.data = data;
  21.          init();
  22.       }
  23.       
  24.       override public function die() : void
  25.       {
  26.          this.basicWindowController.die();
  27.          UI.WINDOW_HOLDER.removeChild(this.panelAsset);
  28.          this.panelAsset.removeChild(this.uiAsset);
  29.          this.panelAsset = null;
  30.          this.uiAsset = null;
  31.       }
  32.       
  33.       override protected function createView() : void
  34.       {
  35.          this.panelAsset = new WindowAssetUI();
  36.          this.panelAsset.cacheAsBitmap = true;
  37.          this.panelAsset.titleBtn.useHandCursor = false;
  38.          this.uiAsset = new BasicWindowUI();
  39.          this.panelAsset.bg.width = 420;
  40.          this.panelAsset.bg.height = 250;
  41.          this.panelAsset.title.text = "";
  42.          this.panelAsset.helpBtn.visible = this.panelAsset.helpBtn.enabled = false;
  43.          this.panelAsset.toggleBtn.visible = this.panelAsset.toggleBtn.enabled = false;
  44.          this.enableDrag = true;
  45.          this.uiAsset.x = 17;
  46.          this.uiAsset.y = 38;
  47.          this.uiAsset.cacheAsBitmap = true;
  48.          this.panelAsset.addChild(this.uiAsset);
  49.          this.panelAsset.x = UI.centerX - this.panelAsset.width / 2;
  50.          this.panelAsset.y = UI.centerY - this.panelAsset.height / 2;
  51.          UI.WINDOW_HOLDER.addChild(this.panelAsset);
  52.          this.update(Update.dataUpdate(this.data));
  53.       }
  54.       
  55.       public function get messageField() : TextField
  56.       {
  57.          return this.uiAsset["message"];
  58.       }
  59.       
  60.       override protected function createController() : void
  61.       {
  62.          controller = new BasicWindowController(this);
  63.       }
  64.       
  65.       override public function update(update:Update = null) : void
  66.       {
  67.          try
  68.          {
  69.             if(update.type == UpdateEvent.DATA)
  70.             {
  71.                this.message = update.data.message;
  72.             }
  73.          }
  74.          catch(e:Error)
  75.          {
  76.          }
  77.       }
  78.       
  79.       public function set message(s:String) : void
  80.       {
  81.          this.messageField.htmlText = s;
  82.       }
  83.       
  84.       public function get basicWindowController() : BasicWindowController
  85.       {
  86.          return BasicWindowController(controller);
  87.       }
  88.    }
  89. }
  90.  
  91.