home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Adobe Air 1.5 / AdobeAIRInstaller.exe / setup.swf / scripts / mx / controls / TextInput.as < prev    next >
Encoding:
Text File  |  2008-10-29  |  28.2 KB  |  922 lines

  1. package mx.controls
  2. {
  3.    import flash.accessibility.AccessibilityProperties;
  4.    import flash.display.DisplayObject;
  5.    import flash.events.Event;
  6.    import flash.events.FocusEvent;
  7.    import flash.events.KeyboardEvent;
  8.    import flash.events.TextEvent;
  9.    import flash.system.IME;
  10.    import flash.system.IMEConversionMode;
  11.    import flash.text.TextField;
  12.    import flash.text.TextFieldAutoSize;
  13.    import flash.text.TextFieldType;
  14.    import flash.text.TextLineMetrics;
  15.    import flash.ui.Keyboard;
  16.    import mx.controls.listClasses.BaseListData;
  17.    import mx.controls.listClasses.IDropInListItemRenderer;
  18.    import mx.controls.listClasses.IListItemRenderer;
  19.    import mx.core.EdgeMetrics;
  20.    import mx.core.FlexVersion;
  21.    import mx.core.IDataRenderer;
  22.    import mx.core.IFlexDisplayObject;
  23.    import mx.core.IFlexModuleFactory;
  24.    import mx.core.IFontContextComponent;
  25.    import mx.core.IIMESupport;
  26.    import mx.core.IInvalidating;
  27.    import mx.core.IRectangularBorder;
  28.    import mx.core.IUITextField;
  29.    import mx.core.UIComponent;
  30.    import mx.core.UITextField;
  31.    import mx.core.mx_internal;
  32.    import mx.events.FlexEvent;
  33.    import mx.managers.IFocusManager;
  34.    import mx.managers.IFocusManagerComponent;
  35.    import mx.styles.ISimpleStyleClient;
  36.    
  37.    use namespace mx_internal;
  38.    
  39.    public class TextInput extends UIComponent implements IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IIMESupport, IListItemRenderer, IFontContextComponent
  40.    {
  41.       mx_internal static const VERSION:String = "3.0.0.0";
  42.       
  43.       private var _text:String = "";
  44.       
  45.       private var _textWidth:Number;
  46.       
  47.       private var _restrict:String;
  48.       
  49.       private var htmlTextChanged:Boolean = false;
  50.       
  51.       mx_internal var border:IFlexDisplayObject;
  52.       
  53.       private var enabledChanged:Boolean = false;
  54.       
  55.       private var _maxChars:int = 0;
  56.       
  57.       private var _condenseWhite:Boolean = false;
  58.       
  59.       private var accessibilityPropertiesChanged:Boolean = false;
  60.       
  61.       private var _textHeight:Number;
  62.       
  63.       private var displayAsPasswordChanged:Boolean = false;
  64.       
  65.       private var prevMode:String = null;
  66.       
  67.       private var selectableChanged:Boolean = false;
  68.       
  69.       private var restrictChanged:Boolean = false;
  70.       
  71.       private var selectionChanged:Boolean = false;
  72.       
  73.       private var _data:Object;
  74.       
  75.       private var maxCharsChanged:Boolean = false;
  76.       
  77.       private var _tabIndex:int = -1;
  78.       
  79.       private var errorCaught:Boolean = false;
  80.       
  81.       private var _selectionBeginIndex:int = 0;
  82.       
  83.       private var explicitHTMLText:String = null;
  84.       
  85.       private var editableChanged:Boolean = false;
  86.       
  87.       mx_internal var parentDrawsFocus:Boolean = false;
  88.       
  89.       private var tabIndexChanged:Boolean = false;
  90.       
  91.       private var _horizontalScrollPosition:Number = 0;
  92.       
  93.       private var _editable:Boolean = true;
  94.       
  95.       private var _imeMode:String = null;
  96.       
  97.       private var condenseWhiteChanged:Boolean = false;
  98.       
  99.       protected var textField:IUITextField;
  100.       
  101.       private var _listData:BaseListData;
  102.       
  103.       private var _displayAsPassword:Boolean = false;
  104.       
  105.       private var textChanged:Boolean = false;
  106.       
  107.       private var _htmlText:String = "";
  108.       
  109.       private var _accessibilityProperties:AccessibilityProperties;
  110.       
  111.       private var _selectionEndIndex:int = 0;
  112.       
  113.       private var textSet:Boolean;
  114.       
  115.       private var horizontalScrollPositionChanged:Boolean = false;
  116.       
  117.       private var _selectable:Boolean = true;
  118.       
  119.       public function TextInput()
  120.       {
  121.          super();
  122.          tabChildren = true;
  123.       }
  124.       
  125.       public function get imeMode() : String
  126.       {
  127.          return _imeMode;
  128.       }
  129.       
  130.       public function set imeMode(param1:String) : void
  131.       {
  132.          _imeMode = param1;
  133.       }
  134.       
  135.       override protected function focusOutHandler(param1:FocusEvent) : void
  136.       {
  137.          super.focusOutHandler(param1);
  138.          if(_imeMode != null && _editable)
  139.          {
  140.             if(IME.conversionMode != IMEConversionMode.UNKNOWN && prevMode != IMEConversionMode.UNKNOWN)
  141.             {
  142.                IME.conversionMode = prevMode;
  143.             }
  144.             IME.enabled = false;
  145.          }
  146.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  147.       }
  148.       
  149.       override public function drawFocus(param1:Boolean) : void
  150.       {
  151.          if(mx_internal::parentDrawsFocus)
  152.          {
  153.             IFocusManagerComponent(parent).drawFocus(param1);
  154.             return;
  155.          }
  156.          super.drawFocus(param1);
  157.       }
  158.       
  159.       mx_internal function getTextField() : IUITextField
  160.       {
  161.          return textField;
  162.       }
  163.       
  164.       private function textField_textInputHandler(param1:TextEvent) : void
  165.       {
  166.          param1.stopImmediatePropagation();
  167.          var _loc2_:TextEvent = new TextEvent(TextEvent.TEXT_INPUT,false,true);
  168.          _loc2_.text = param1.text;
  169.          dispatchEvent(_loc2_);
  170.          if(_loc2_.isDefaultPrevented())
  171.          {
  172.             param1.preventDefault();
  173.          }
  174.       }
  175.       
  176.       override public function get accessibilityProperties() : AccessibilityProperties
  177.       {
  178.          return _accessibilityProperties;
  179.       }
  180.       
  181.       override protected function createChildren() : void
  182.       {
  183.          super.createChildren();
  184.          createBorder();
  185.          mx_internal::createTextField(-1);
  186.       }
  187.       
  188.       private function textFieldChanged(param1:Boolean, param2:Boolean) : void
  189.       {
  190.          var _loc3_:* = false;
  191.          var _loc4_:* = false;
  192.          if(!param1)
  193.          {
  194.             _loc3_ = _text != textField.text;
  195.             _text = textField.text;
  196.          }
  197.          _loc4_ = _htmlText != textField.htmlText;
  198.          _htmlText = textField.htmlText;
  199.          if(_loc3_)
  200.          {
  201.             dispatchEvent(new Event("textChanged"));
  202.             if(param2)
  203.             {
  204.                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  205.             }
  206.          }
  207.          if(_loc4_)
  208.          {
  209.             dispatchEvent(new Event("htmlTextChanged"));
  210.          }
  211.          _textWidth = textField.textWidth;
  212.          _textHeight = textField.textHeight;
  213.       }
  214.       
  215.       [NonCommittingChangeEvent("change")]
  216.       [Bindable("textChanged")]
  217.       public function get text() : String
  218.       {
  219.          return _text;
  220.       }
  221.       
  222.       mx_internal function createTextField(param1:int) : void
  223.       {
  224.          if(!textField)
  225.          {
  226.             textField = IUITextField(createInFontContext(UITextField));
  227.             textField.autoSize = TextFieldAutoSize.NONE;
  228.             textField.enabled = enabled;
  229.             textField.ignorePadding = false;
  230.             textField.multiline = false;
  231.             textField.tabEnabled = true;
  232.             textField.wordWrap = false;
  233.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  234.             {
  235.                textField.styleName = this;
  236.             }
  237.             textField.addEventListener(Event.CHANGE,textField_changeHandler);
  238.             textField.addEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  239.             textField.addEventListener(Event.SCROLL,textField_scrollHandler);
  240.             textField.addEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  241.             textField.addEventListener("textFormatChange",textField_textFormatChangeHandler);
  242.             textField.addEventListener("textInsert",textField_textModifiedHandler);
  243.             textField.addEventListener("textReplace",textField_textModifiedHandler);
  244.             if(param1 == -1)
  245.             {
  246.                addChild(DisplayObject(textField));
  247.             }
  248.             else
  249.             {
  250.                addChildAt(DisplayObject(textField),param1);
  251.             }
  252.          }
  253.       }
  254.       
  255.       override public function get tabIndex() : int
  256.       {
  257.          return _tabIndex;
  258.       }
  259.       
  260.       override public function set accessibilityProperties(param1:AccessibilityProperties) : void
  261.       {
  262.          if(param1 == _accessibilityProperties)
  263.          {
  264.             return;
  265.          }
  266.          _accessibilityProperties = param1;
  267.          accessibilityPropertiesChanged = true;
  268.          invalidateProperties();
  269.       }
  270.       
  271.       public function setSelection(param1:int, param2:int) : void
  272.       {
  273.          _selectionBeginIndex = param1;
  274.          _selectionEndIndex = param2;
  275.          selectionChanged = true;
  276.          invalidateProperties();
  277.       }
  278.       
  279.       [Bindable("condenseWhiteChanged")]
  280.       public function get condenseWhite() : Boolean
  281.       {
  282.          return _condenseWhite;
  283.       }
  284.       
  285.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  286.       {
  287.          return param1 == textField || super.isOurFocus(param1);
  288.       }
  289.       
  290.       [Bindable("displayAsPasswordChanged")]
  291.       public function get displayAsPassword() : Boolean
  292.       {
  293.          return _displayAsPassword;
  294.       }
  295.       
  296.       public function set data(param1:Object) : void
  297.       {
  298.          var _loc2_:* = undefined;
  299.          _data = param1;
  300.          if(_listData)
  301.          {
  302.             _loc2_ = _listData.label;
  303.          }
  304.          else if(_data != null)
  305.          {
  306.             if(_data is String)
  307.             {
  308.                _loc2_ = String(_data);
  309.             }
  310.             else
  311.             {
  312.                _loc2_ = _data.toString();
  313.             }
  314.          }
  315.          if(_loc2_ !== undefined && !textSet)
  316.          {
  317.             text = _loc2_;
  318.             textSet = false;
  319.          }
  320.          dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
  321.       }
  322.       
  323.       public function get selectionBeginIndex() : int
  324.       {
  325.          return !!textField ? textField.selectionBeginIndex : _selectionBeginIndex;
  326.       }
  327.       
  328.       mx_internal function get selectable() : Boolean
  329.       {
  330.          return _selectable;
  331.       }
  332.       
  333.       protected function createBorder() : void
  334.       {
  335.          var _loc1_:Class = null;
  336.          if(!mx_internal::border)
  337.          {
  338.             _loc1_ = getStyle("borderSkin");
  339.             if(_loc1_ != null)
  340.             {
  341.                mx_internal::border = new _loc1_();
  342.                if(mx_internal::border is ISimpleStyleClient)
  343.                {
  344.                   ISimpleStyleClient(mx_internal::border).styleName = this;
  345.                }
  346.                addChildAt(DisplayObject(mx_internal::border),0);
  347.                invalidateDisplayList();
  348.             }
  349.          }
  350.       }
  351.       
  352.       [Bindable("horizontalScrollPositionChanged")]
  353.       public function get horizontalScrollPosition() : Number
  354.       {
  355.          return _horizontalScrollPosition;
  356.       }
  357.       
  358.       override protected function measure() : void
  359.       {
  360.          var _loc2_:Number = NaN;
  361.          var _loc3_:Number = NaN;
  362.          var _loc4_:TextLineMetrics = null;
  363.          super.measure();
  364.          var _loc1_:EdgeMetrics = Boolean(mx_internal::border) && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  365.          measuredWidth = DEFAULT_MEASURED_WIDTH;
  366.          if(maxChars)
  367.          {
  368.             measuredWidth = Math.min(measuredWidth,measureText("W").width * maxChars + _loc1_.left + _loc1_.right + 8);
  369.          }
  370.          if(!text || text == "")
  371.          {
  372.             _loc2_ = DEFAULT_MEASURED_MIN_WIDTH;
  373.             _loc3_ = measureText(" ").height + _loc1_.top + _loc1_.bottom + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  374.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  375.             {
  376.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  377.             }
  378.          }
  379.          else
  380.          {
  381.             _loc4_ = measureText(text);
  382.             _loc2_ = _loc4_.width + _loc1_.left + _loc1_.right + 8;
  383.             _loc3_ = _loc4_.height + _loc1_.top + _loc1_.bottom + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  384.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  385.             {
  386.                _loc2_ += getStyle("paddingLeft") + getStyle("paddingRight");
  387.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  388.             }
  389.          }
  390.          measuredWidth = Math.max(_loc2_,measuredWidth);
  391.          measuredHeight = Math.max(_loc3_,DEFAULT_MEASURED_HEIGHT);
  392.          measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  393.          measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT;
  394.       }
  395.       
  396.       public function get fontContext() : IFlexModuleFactory
  397.       {
  398.          return moduleFactory;
  399.       }
  400.       
  401.       public function set text(param1:String) : void
  402.       {
  403.          textSet = true;
  404.          if(!param1)
  405.          {
  406.             param1 = "";
  407.          }
  408.          if(!isHTML && param1 == _text)
  409.          {
  410.             return;
  411.          }
  412.          _text = param1;
  413.          textChanged = true;
  414.          _htmlText = null;
  415.          explicitHTMLText = null;
  416.          invalidateProperties();
  417.          invalidateSize();
  418.          invalidateDisplayList();
  419.          dispatchEvent(new Event("textChanged"));
  420.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  421.       }
  422.       
  423.       public function get selectionEndIndex() : int
  424.       {
  425.          return !!textField ? textField.selectionEndIndex : _selectionEndIndex;
  426.       }
  427.       
  428.       [Bindable("editableChanged")]
  429.       public function get editable() : Boolean
  430.       {
  431.          return _editable;
  432.       }
  433.       
  434.       [Bindable("dataChange")]
  435.       public function get listData() : BaseListData
  436.       {
  437.          return _listData;
  438.       }
  439.       
  440.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  441.       {
  442.          switch(param1.keyCode)
  443.          {
  444.             case Keyboard.ENTER:
  445.                dispatchEvent(new FlexEvent(FlexEvent.ENTER));
  446.          }
  447.       }
  448.       
  449.       override protected function focusInHandler(param1:FocusEvent) : void
  450.       {
  451.          var fm:IFocusManager;
  452.          var message:String = null;
  453.          var event:FocusEvent = param1;
  454.          if(event.target == this)
  455.          {
  456.             systemManager.stage.focus = TextField(textField);
  457.          }
  458.          fm = focusManager;
  459.          if(editable && Boolean(fm))
  460.          {
  461.             fm.showFocusIndicator = true;
  462.             if(textField.selectable && _selectionBeginIndex == _selectionEndIndex)
  463.             {
  464.                textField.setSelection(0,textField.length);
  465.             }
  466.          }
  467.          super.focusInHandler(event);
  468.          if(_imeMode != null && _editable)
  469.          {
  470.             IME.enabled = true;
  471.             prevMode = IME.conversionMode;
  472.             try
  473.             {
  474.                if(!errorCaught && IME.conversionMode != IMEConversionMode.UNKNOWN)
  475.                {
  476.                   IME.conversionMode = _imeMode;
  477.                }
  478.                errorCaught = false;
  479.             }
  480.             catch(e:Error)
  481.             {
  482.                errorCaught = true;
  483.                message = resourceManager.getString("controls","unsupportedMode",[_imeMode]);
  484.                throw new Error(message);
  485.             }
  486.          }
  487.       }
  488.       
  489.       [NonCommittingChangeEvent("change")]
  490.       [Bindable("htmlTextChanged")]
  491.       public function get htmlText() : String
  492.       {
  493.          return _htmlText;
  494.       }
  495.       
  496.       override public function set tabIndex(param1:int) : void
  497.       {
  498.          if(param1 == _tabIndex)
  499.          {
  500.             return;
  501.          }
  502.          _tabIndex = param1;
  503.          tabIndexChanged = true;
  504.          invalidateProperties();
  505.       }
  506.       
  507.       public function set restrict(param1:String) : void
  508.       {
  509.          if(param1 == _restrict)
  510.          {
  511.             return;
  512.          }
  513.          _restrict = param1;
  514.          restrictChanged = true;
  515.          invalidateProperties();
  516.          dispatchEvent(new Event("restrictChanged"));
  517.       }
  518.       
  519.       private function textField_textFieldStyleChangeHandler(param1:Event) : void
  520.       {
  521.          textFieldChanged(true,false);
  522.       }
  523.       
  524.       private function textField_changeHandler(param1:Event) : void
  525.       {
  526.          textFieldChanged(false,false);
  527.          textChanged = false;
  528.          htmlTextChanged = false;
  529.          param1.stopImmediatePropagation();
  530.          dispatchEvent(new Event(Event.CHANGE));
  531.       }
  532.       
  533.       override public function set enabled(param1:Boolean) : void
  534.       {
  535.          if(param1 == enabled)
  536.          {
  537.             return;
  538.          }
  539.          super.enabled = param1;
  540.          enabledChanged = true;
  541.          invalidateProperties();
  542.          if(Boolean(mx_internal::border) && mx_internal::border is IInvalidating)
  543.          {
  544.             IInvalidating(mx_internal::border).invalidateDisplayList();
  545.          }
  546.       }
  547.       
  548.       override public function get baselinePosition() : Number
  549.       {
  550.          var _loc1_:String = null;
  551.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  552.          {
  553.             _loc1_ = text;
  554.             if(_loc1_ == "")
  555.             {
  556.                _loc1_ = " ";
  557.             }
  558.             return (Boolean(mx_internal::border) && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics.top : 0) + measureText(_loc1_).ascent;
  559.          }
  560.          if(!mx_internal::validateBaselinePosition())
  561.          {
  562.             return NaN;
  563.          }
  564.          return textField.y + textField.baselinePosition;
  565.       }
  566.       
  567.       public function set condenseWhite(param1:Boolean) : void
  568.       {
  569.          if(param1 == _condenseWhite)
  570.          {
  571.             return;
  572.          }
  573.          _condenseWhite = param1;
  574.          condenseWhiteChanged = true;
  575.          if(isHTML)
  576.          {
  577.             htmlTextChanged = true;
  578.          }
  579.          invalidateProperties();
  580.          invalidateSize();
  581.          invalidateDisplayList();
  582.          dispatchEvent(new Event("condenseWhiteChanged"));
  583.       }
  584.       
  585.       public function get textWidth() : Number
  586.       {
  587.          return _textWidth;
  588.       }
  589.       
  590.       public function set displayAsPassword(param1:Boolean) : void
  591.       {
  592.          if(param1 == _displayAsPassword)
  593.          {
  594.             return;
  595.          }
  596.          _displayAsPassword = param1;
  597.          displayAsPasswordChanged = true;
  598.          invalidateProperties();
  599.          invalidateSize();
  600.          invalidateDisplayList();
  601.          dispatchEvent(new Event("displayAsPasswordChanged"));
  602.       }
  603.       
  604.       mx_internal function removeTextField() : void
  605.       {
  606.          if(textField)
  607.          {
  608.             textField.removeEventListener(Event.CHANGE,textField_changeHandler);
  609.             textField.removeEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  610.             textField.removeEventListener(Event.SCROLL,textField_scrollHandler);
  611.             textField.removeEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  612.             textField.removeEventListener("textFormatChange",textField_textFormatChangeHandler);
  613.             textField.removeEventListener("textInsert",textField_textModifiedHandler);
  614.             textField.removeEventListener("textReplace",textField_textModifiedHandler);
  615.             removeChild(DisplayObject(textField));
  616.             textField = null;
  617.          }
  618.       }
  619.       
  620.       [Bindable("dataChange")]
  621.       public function get data() : Object
  622.       {
  623.          return _data;
  624.       }
  625.       
  626.       public function set maxChars(param1:int) : void
  627.       {
  628.          if(param1 == _maxChars)
  629.          {
  630.             return;
  631.          }
  632.          _maxChars = param1;
  633.          maxCharsChanged = true;
  634.          invalidateProperties();
  635.          dispatchEvent(new Event("maxCharsChanged"));
  636.       }
  637.       
  638.       public function set horizontalScrollPosition(param1:Number) : void
  639.       {
  640.          if(param1 == _horizontalScrollPosition)
  641.          {
  642.             return;
  643.          }
  644.          _horizontalScrollPosition = param1;
  645.          horizontalScrollPositionChanged = true;
  646.          invalidateProperties();
  647.          dispatchEvent(new Event("horizontalScrollPositionChanged"));
  648.       }
  649.       
  650.       override public function setFocus() : void
  651.       {
  652.          textField.setFocus();
  653.       }
  654.       
  655.       [Bindable("restrictChanged")]
  656.       public function get restrict() : String
  657.       {
  658.          return _restrict;
  659.       }
  660.       
  661.       public function set fontContext(param1:IFlexModuleFactory) : void
  662.       {
  663.          this.moduleFactory = param1;
  664.       }
  665.       
  666.       public function set selectionBeginIndex(param1:int) : void
  667.       {
  668.          _selectionBeginIndex = param1;
  669.          selectionChanged = true;
  670.          invalidateProperties();
  671.       }
  672.       
  673.       public function set selectionEndIndex(param1:int) : void
  674.       {
  675.          _selectionEndIndex = param1;
  676.          selectionChanged = true;
  677.          invalidateProperties();
  678.       }
  679.       
  680.       private function textField_scrollHandler(param1:Event) : void
  681.       {
  682.          _horizontalScrollPosition = textField.scrollH;
  683.       }
  684.       
  685.       public function get textHeight() : Number
  686.       {
  687.          return _textHeight;
  688.       }
  689.       
  690.       public function set editable(param1:Boolean) : void
  691.       {
  692.          if(param1 == _editable)
  693.          {
  694.             return;
  695.          }
  696.          _editable = param1;
  697.          editableChanged = true;
  698.          invalidateProperties();
  699.          dispatchEvent(new Event("editableChanged"));
  700.       }
  701.       
  702.       override protected function commitProperties() : void
  703.       {
  704.          var _loc1_:int = 0;
  705.          super.commitProperties();
  706.          if(hasFontContextChanged() && textField != null)
  707.          {
  708.             _loc1_ = getChildIndex(DisplayObject(textField));
  709.             mx_internal::removeTextField();
  710.             mx_internal::createTextField(_loc1_);
  711.             accessibilityPropertiesChanged = true;
  712.             condenseWhiteChanged = true;
  713.             displayAsPasswordChanged = true;
  714.             enabledChanged = true;
  715.             maxCharsChanged = true;
  716.             restrictChanged = true;
  717.             tabIndexChanged = true;
  718.             textChanged = true;
  719.             selectionChanged = true;
  720.             horizontalScrollPositionChanged = true;
  721.          }
  722.          if(accessibilityPropertiesChanged)
  723.          {
  724.             textField.accessibilityProperties = _accessibilityProperties;
  725.             accessibilityPropertiesChanged = false;
  726.          }
  727.          if(condenseWhiteChanged)
  728.          {
  729.             textField.condenseWhite = _condenseWhite;
  730.             condenseWhiteChanged = false;
  731.          }
  732.          if(displayAsPasswordChanged)
  733.          {
  734.             textField.displayAsPassword = _displayAsPassword;
  735.             displayAsPasswordChanged = false;
  736.          }
  737.          if(enabledChanged || editableChanged)
  738.          {
  739.             textField.type = enabled && _editable ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
  740.             if(enabledChanged)
  741.             {
  742.                if(textField.enabled != enabled)
  743.                {
  744.                   textField.enabled = enabled;
  745.                }
  746.                enabledChanged = false;
  747.             }
  748.             selectableChanged = true;
  749.             editableChanged = false;
  750.          }
  751.          if(selectableChanged)
  752.          {
  753.             if(_editable)
  754.             {
  755.                textField.selectable = enabled;
  756.             }
  757.             else
  758.             {
  759.                textField.selectable = enabled && _selectable;
  760.             }
  761.             selectableChanged = false;
  762.          }
  763.          if(maxCharsChanged)
  764.          {
  765.             textField.maxChars = _maxChars;
  766.             maxCharsChanged = false;
  767.          }
  768.          if(restrictChanged)
  769.          {
  770.             textField.restrict = _restrict;
  771.             restrictChanged = false;
  772.          }
  773.          if(tabIndexChanged)
  774.          {
  775.             textField.tabIndex = _tabIndex;
  776.             tabIndexChanged = false;
  777.          }
  778.          if(textChanged || htmlTextChanged)
  779.          {
  780.             if(isHTML)
  781.             {
  782.                textField.htmlText = explicitHTMLText;
  783.             }
  784.             else
  785.             {
  786.                textField.text = _text;
  787.             }
  788.             textFieldChanged(false,true);
  789.             textChanged = false;
  790.             htmlTextChanged = false;
  791.          }
  792.          if(selectionChanged)
  793.          {
  794.             textField.setSelection(_selectionBeginIndex,_selectionEndIndex);
  795.             selectionChanged = false;
  796.          }
  797.          if(horizontalScrollPositionChanged)
  798.          {
  799.             textField.scrollH = _horizontalScrollPosition;
  800.             horizontalScrollPositionChanged = false;
  801.          }
  802.       }
  803.       
  804.       override public function styleChanged(param1:String) : void
  805.       {
  806.          var _loc2_:Boolean = param1 == null || param1 == "styleName";
  807.          super.styleChanged(param1);
  808.          if(_loc2_ || param1 == "borderSkin")
  809.          {
  810.             if(mx_internal::border)
  811.             {
  812.                removeChild(DisplayObject(mx_internal::border));
  813.                mx_internal::border = null;
  814.                createBorder();
  815.             }
  816.          }
  817.       }
  818.       
  819.       private function get isHTML() : Boolean
  820.       {
  821.          return explicitHTMLText != null;
  822.       }
  823.       
  824.       [Bindable("maxCharsChanged")]
  825.       public function get maxChars() : int
  826.       {
  827.          return _maxChars;
  828.       }
  829.       
  830.       public function get maxHorizontalScrollPosition() : Number
  831.       {
  832.          return !!textField ? textField.maxScrollH : 0;
  833.       }
  834.       
  835.       mx_internal function set selectable(param1:Boolean) : void
  836.       {
  837.          if(_selectable == param1)
  838.          {
  839.             return;
  840.          }
  841.          _selectable = param1;
  842.          selectableChanged = true;
  843.          invalidateProperties();
  844.       }
  845.       
  846.       public function get length() : int
  847.       {
  848.          return text != null ? text.length : -1;
  849.       }
  850.       
  851.       public function set listData(param1:BaseListData) : void
  852.       {
  853.          _listData = param1;
  854.       }
  855.       
  856.       private function textField_textModifiedHandler(param1:Event) : void
  857.       {
  858.          textFieldChanged(false,true);
  859.       }
  860.       
  861.       private function textField_textFormatChangeHandler(param1:Event) : void
  862.       {
  863.          textFieldChanged(true,false);
  864.       }
  865.       
  866.       public function set htmlText(param1:String) : void
  867.       {
  868.          textSet = true;
  869.          if(!param1)
  870.          {
  871.             param1 = "";
  872.          }
  873.          _htmlText = param1;
  874.          htmlTextChanged = true;
  875.          _text = null;
  876.          explicitHTMLText = param1;
  877.          invalidateProperties();
  878.          invalidateSize();
  879.          invalidateDisplayList();
  880.          dispatchEvent(new Event("htmlTextChanged"));
  881.       }
  882.       
  883.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  884.       {
  885.          var _loc3_:EdgeMetrics = null;
  886.          super.updateDisplayList(param1,param2);
  887.          if(mx_internal::border)
  888.          {
  889.             mx_internal::border.setActualSize(param1,param2);
  890.             _loc3_ = mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  891.          }
  892.          else
  893.          {
  894.             _loc3_ = EdgeMetrics.EMPTY;
  895.          }
  896.          var _loc4_:Number = getStyle("paddingLeft");
  897.          var _loc5_:Number = getStyle("paddingRight");
  898.          var _loc6_:Number = getStyle("paddingTop");
  899.          var _loc7_:Number = getStyle("paddingBottom");
  900.          var _loc8_:Number = _loc3_.left + _loc3_.right;
  901.          var _loc9_:Number = _loc3_.top + _loc3_.bottom + 1;
  902.          textField.x = _loc3_.left;
  903.          textField.y = _loc3_.top;
  904.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  905.          {
  906.             textField.x += _loc4_;
  907.             textField.y += _loc6_;
  908.             _loc8_ += _loc4_ + _loc5_;
  909.             _loc9_ += _loc6_ + _loc7_;
  910.          }
  911.          textField.width = Math.max(0,param1 - _loc8_);
  912.          textField.height = Math.max(0,param2 - _loc9_);
  913.       }
  914.       
  915.       public function getLineMetrics(param1:int) : TextLineMetrics
  916.       {
  917.          return !!textField ? textField.getLineMetrics(param1) : null;
  918.       }
  919.    }
  920. }
  921.  
  922.