home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / fwg_knight.swf / scripts / __Packages / Txt.as < prev   
Encoding:
Text File  |  2008-08-28  |  2.2 KB  |  93 lines

  1. class Txt extends MovieClip
  2. {
  3.    var obFormat;
  4.    var mAni;
  5.    var tTxt;
  6.    var obCustom;
  7.    var owner;
  8.    var text;
  9.    var sVariable;
  10.    var __sTxt;
  11.    var _obFormat;
  12.    function Txt()
  13.    {
  14.       super();
  15.       this.obFormat = new TextFormat();
  16.       this.obFormat.align = "left";
  17.    }
  18.    function init(_sTxt)
  19.    {
  20.       if(_sTxt != "undefined")
  21.       {
  22.          this.sTxt = _sTxt;
  23.       }
  24.       if(this.mAni == undefined)
  25.       {
  26.          this.filters = this.tTxt.filters;
  27.          this.tTxt.filters = null;
  28.          delete this.tTxt.filters;
  29.       }
  30.       else
  31.       {
  32.          this.mAni.setMask(this.tTxt);
  33.       }
  34.       if(this.obCustom.bCustom)
  35.       {
  36.          for(var _loc2_ in this.obCustom)
  37.          {
  38.             if(_loc2_ != "bCustom" && this.obCustom[_loc2_] != undefined)
  39.             {
  40.                this.tTxt[_loc2_] = this.obCustom[_loc2_];
  41.             }
  42.          }
  43.          if(this.tTxt.type == "input")
  44.          {
  45.             Selection.setFocus(this.tTxt);
  46.             this.tTxt.owner = this;
  47.             this.tTxt.onChanged = function()
  48.             {
  49.                this.owner.sTxt = this.text;
  50.             };
  51.          }
  52.       }
  53.       this.sVariable.length > 0 && (this.tTxt.variable = this.sVariable);
  54.       this.replace();
  55.    }
  56.    function get sTxt()
  57.    {
  58.       return this.__sTxt;
  59.    }
  60.    function set sTxt(_sTxt)
  61.    {
  62.       this.__sTxt = _sTxt;
  63.       this.replace();
  64.    }
  65.    function replace()
  66.    {
  67.       for(var _loc2_ in this._obFormat)
  68.       {
  69.          this.obFormat[_loc2_] = this._obFormat[_loc2_];
  70.       }
  71.       this.tTxt.autoSize = this.obFormat.align;
  72.       if(this.obFormat.align == "right")
  73.       {
  74.          this.tTxt._x = - Math.floor(this.tTxt._width);
  75.       }
  76.       else if(this.obFormat.align == "center")
  77.       {
  78.          this.tTxt._x = - Math.floor(this.tTxt._width / 2);
  79.       }
  80.       else
  81.       {
  82.          this.tTxt._x = 0;
  83.       }
  84.       this.tTxt.setTextFormat(this.obFormat);
  85.       if(this.mAni != undefined)
  86.       {
  87.          this.mAni._width = this.tTxt._width + 5;
  88.          this.mAni._height = int(this.tTxt._height) + 5;
  89.          this.mAni._x = this.tTxt._x;
  90.       }
  91.    }
  92. }
  93.