home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / ENGINE / INTERFACE / ELEMENTS / OInputTextField.as < prev    next >
Encoding:
Text File  |  2008-09-12  |  2.8 KB  |  88 lines

  1. package ENGINE.INTERFACE.ELEMENTS
  2. {
  3.    import ENGINE.CORE.OGlobal;
  4.    import ENGINE.DISPLAY.ODisplay;
  5.    import flash.display.Sprite;
  6.    import flash.events.FocusEvent;
  7.    import flash.text.TextField;
  8.    import flash.text.TextFieldAutoSize;
  9.    import flash.text.TextFieldType;
  10.    import flash.text.TextFormat;
  11.    
  12.    public class OInputTextField extends TextField
  13.    {
  14.        
  15.       
  16.       private var iTextFormat:TextFormat;
  17.       
  18.       public function OInputTextField(param1:Number, param2:Number, param3:*, param4:Number, param5:Number, param6:Boolean, param7:Array, param8:String, param9:int, param10:Number, param11:Number)
  19.       {
  20.          var _loc12_:Number = NaN;
  21.          var _loc13_:Sprite = null;
  22.          super();
  23.          _loc12_ = OGlobal.Scale;
  24.          this.type = TextFieldType.INPUT;
  25.          this.autoSize = TextFieldAutoSize.NONE;
  26.          this.embedFonts = true;
  27.          if((_loc13_ = param3 is Sprite ? param3 as Sprite : new (param3 as Class)()).getChildAt(0) is TextField)
  28.          {
  29.             this.iTextFormat = (_loc13_.getChildAt(0) as TextField).getTextFormat();
  30.          }
  31.          else
  32.          {
  33.             this.iTextFormat = this.defaultTextFormat;
  34.          }
  35.          this.iTextFormat.size = param4 * _loc12_;
  36.          this.iTextFormat.letterSpacing = param5 * _loc12_;
  37.          this.iTextFormat.color = ODisplay.HSBToRGB(param7[0],param7[1],param7[2]);
  38.          this.defaultTextFormat = this.iTextFormat;
  39.          this.prText = param8;
  40.          this.width = param1 * _loc12_;
  41.          this.height = param2 * _loc12_;
  42.          this.x = param10 * _loc12_;
  43.          this.y = param11 * _loc12_;
  44.          this.border = param6;
  45.          this.maxChars = param9;
  46.          this.restrict = "A-Za-z0-9 @._\\-";
  47.          this.addEventListener(FocusEvent.KEY_FOCUS_CHANGE,OnFocusIn);
  48.       }
  49.       
  50.       public function set prText(param1:String) : void
  51.       {
  52.          this.text = !param1 || param1 == "" ? " " : param1;
  53.       }
  54.       
  55.       protected function OnFocusIn(param1:FocusEvent) : void
  56.       {
  57.          this.setTextFormat(this.iTextFormat);
  58.       }
  59.       
  60.       public function set prFormat(param1:TextFormat) : void
  61.       {
  62.          this.iTextFormat = param1;
  63.          this.defaultTextFormat = param1;
  64.          this.setTextFormat(this.iTextFormat);
  65.       }
  66.       
  67.       public function get prText() : String
  68.       {
  69.          var _loc1_:String = null;
  70.          _loc1_ = this.text;
  71.          while(_loc1_.charAt() == " ")
  72.          {
  73.             _loc1_ = _loc1_.substr(1);
  74.          }
  75.          while(_loc1_.charAt(_loc1_.length - 1) == " ")
  76.          {
  77.             _loc1_ = _loc1_.substr(0,_loc1_.length - 1);
  78.          }
  79.          return _loc1_;
  80.       }
  81.       
  82.       public function get prFormat() : TextFormat
  83.       {
  84.          return this.iTextFormat;
  85.       }
  86.    }
  87. }
  88.