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 / Dialog.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  2.2 KB  |  94 lines

  1. package com.livebrush.ui
  2. {
  3.    public class Dialog extends UIModel
  4.    {
  5.       public static var NOTICE:String = "notice";
  6.       
  7.       public static var LOADING:String = "loading";
  8.       
  9.       public static var QUESTION:String = "question";
  10.       
  11.       public static var DELAY:String = "delay";
  12.       
  13.       public static var PROCESS:String = "process";
  14.       
  15.       public var type:String;
  16.       
  17.       public var id:String = "";
  18.       
  19.       public var ui:UI;
  20.       
  21.       public var data:Object;
  22.       
  23.       public var dialogView:DialogView;
  24.       
  25.       public var noFunction:Function;
  26.       
  27.       public var thisScope:Object;
  28.       
  29.       public var yesFunction:Function;
  30.       
  31.       public function Dialog(type:String, data:Object = null)
  32.       {
  33.          super();
  34.          this.ui = UI.MAIN_UI;
  35.          this.type = type;
  36.          this.data = data;
  37.          this.yesFunction = data.yesFunction;
  38.          this.noFunction = data.noFunction;
  39.          this.id = data.id != null ? data.id : "";
  40.          this.thisScope = data.thisScope != null ? data.thisScope : this;
  41.          this.init();
  42.       }
  43.       
  44.       public function yesAction() : void
  45.       {
  46.          this.close();
  47.          try
  48.          {
  49.             if(this.data.yesProps != null)
  50.             {
  51.                this.yesFunction.apply(this.thisScope,this.data.yesProps);
  52.             }
  53.             else
  54.             {
  55.                this.yesFunction();
  56.             }
  57.          }
  58.          catch(e:Error)
  59.          {
  60.          }
  61.       }
  62.       
  63.       private function init() : void
  64.       {
  65.          this.dialogView = DialogView(registerView(new DialogView(this)));
  66.       }
  67.       
  68.       public function noAction() : void
  69.       {
  70.          this.close();
  71.          try
  72.          {
  73.             if(this.data.noProps != null)
  74.             {
  75.                this.noFunction.apply(this.thisScope,this.data.noProps);
  76.             }
  77.             else
  78.             {
  79.                this.noFunction();
  80.             }
  81.          }
  82.          catch(e:Error)
  83.          {
  84.          }
  85.       }
  86.       
  87.       public function close() : void
  88.       {
  89.          this.ui.closeDialog(this);
  90.       }
  91.    }
  92. }
  93.  
  94.