home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / mx / controls / TextInput.as < prev    next >
Encoding:
Text File  |  2010-06-23  |  28.7 KB  |  934 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.5.0.12683";
  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 = "UNKNOWN";
  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.             textField.addEventListener("nativeDragDrop",textField_nativeDragDropHandler);
  245.             if(param1 == -1)
  246.             {
  247.                addChild(DisplayObject(textField));
  248.             }
  249.             else
  250.             {
  251.                addChildAt(DisplayObject(textField),param1);
  252.             }
  253.          }
  254.       }
  255.       
  256.       override public function get tabIndex() : int
  257.       {
  258.          return _tabIndex;
  259.       }
  260.       
  261.       override public function set accessibilityProperties(param1:AccessibilityProperties) : void
  262.       {
  263.          if(param1 == _accessibilityProperties)
  264.          {
  265.             return;
  266.          }
  267.          _accessibilityProperties = param1;
  268.          accessibilityPropertiesChanged = true;
  269.          invalidateProperties();
  270.       }
  271.       
  272.       public function setSelection(param1:int, param2:int) : void
  273.       {
  274.          _selectionBeginIndex = param1;
  275.          _selectionEndIndex = param2;
  276.          selectionChanged = true;
  277.          invalidateProperties();
  278.       }
  279.       
  280.       [Bindable("condenseWhiteChanged")]
  281.       public function get condenseWhite() : Boolean
  282.       {
  283.          return _condenseWhite;
  284.       }
  285.       
  286.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  287.       {
  288.          return param1 == textField || super.isOurFocus(param1);
  289.       }
  290.       
  291.       [Bindable("displayAsPasswordChanged")]
  292.       public function get displayAsPassword() : Boolean
  293.       {
  294.          return _displayAsPassword;
  295.       }
  296.       
  297.       public function set data(param1:Object) : void
  298.       {
  299.          var _loc2_:* = undefined;
  300.          _data = param1;
  301.          if(_listData)
  302.          {
  303.             _loc2_ = _listData.label;
  304.          }
  305.          else if(_data != null)
  306.          {
  307.             if(_data is String)
  308.             {
  309.                _loc2_ = String(_data);
  310.             }
  311.             else
  312.             {
  313.                _loc2_ = _data.toString();
  314.             }
  315.          }
  316.          if(_loc2_ !== undefined && !textSet)
  317.          {
  318.             text = _loc2_;
  319.             textSet = false;
  320.             textField.setSelection(0,0);
  321.          }
  322.          dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
  323.       }
  324.       
  325.       public function get selectionBeginIndex() : int
  326.       {
  327.          return !!textField ? textField.selectionBeginIndex : _selectionBeginIndex;
  328.       }
  329.       
  330.       mx_internal function get selectable() : Boolean
  331.       {
  332.          return _selectable;
  333.       }
  334.       
  335.       protected function createBorder() : void
  336.       {
  337.          var _loc1_:Class = null;
  338.          if(!mx_internal::border)
  339.          {
  340.             _loc1_ = getStyle("borderSkin");
  341.             if(_loc1_ != null)
  342.             {
  343.                mx_internal::border = new _loc1_();
  344.                if(mx_internal::border is ISimpleStyleClient)
  345.                {
  346.                   ISimpleStyleClient(mx_internal::border).styleName = this;
  347.                }
  348.                addChildAt(DisplayObject(mx_internal::border),0);
  349.                invalidateDisplayList();
  350.             }
  351.          }
  352.       }
  353.       
  354.       [Bindable("horizontalScrollPositionChanged")]
  355.       public function get horizontalScrollPosition() : Number
  356.       {
  357.          return _horizontalScrollPosition;
  358.       }
  359.       
  360.       override protected function measure() : void
  361.       {
  362.          var _loc2_:Number = NaN;
  363.          var _loc3_:Number = NaN;
  364.          var _loc4_:TextLineMetrics = null;
  365.          super.measure();
  366.          var _loc1_:EdgeMetrics = Boolean(mx_internal::border) && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  367.          measuredWidth = DEFAULT_MEASURED_WIDTH;
  368.          if(maxChars)
  369.          {
  370.             measuredWidth = Math.min(measuredWidth,measureText("W").width * maxChars + _loc1_.left + _loc1_.right + 8);
  371.          }
  372.          if(!text || text == "")
  373.          {
  374.             _loc2_ = DEFAULT_MEASURED_MIN_WIDTH;
  375.             _loc3_ = measureText(" ").height + _loc1_.top + _loc1_.bottom + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  376.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  377.             {
  378.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  379.             }
  380.          }
  381.          else
  382.          {
  383.             _loc4_ = measureText(text);
  384.             _loc2_ = _loc4_.width + _loc1_.left + _loc1_.right + 8;
  385.             _loc3_ = _loc4_.height + _loc1_.top + _loc1_.bottom + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  386.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  387.             {
  388.                _loc2_ += getStyle("paddingLeft") + getStyle("paddingRight");
  389.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  390.             }
  391.          }
  392.          measuredWidth = Math.max(_loc2_,measuredWidth);
  393.          measuredHeight = Math.max(_loc3_,DEFAULT_MEASURED_HEIGHT);
  394.          measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  395.          measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT;
  396.       }
  397.       
  398.       public function get fontContext() : IFlexModuleFactory
  399.       {
  400.          return moduleFactory;
  401.       }
  402.       
  403.       public function set text(param1:String) : void
  404.       {
  405.          textSet = true;
  406.          if(!param1)
  407.          {
  408.             param1 = "";
  409.          }
  410.          if(!isHTML && param1 == _text)
  411.          {
  412.             return;
  413.          }
  414.          _text = param1;
  415.          textChanged = true;
  416.          _htmlText = null;
  417.          explicitHTMLText = null;
  418.          invalidateProperties();
  419.          invalidateSize();
  420.          invalidateDisplayList();
  421.          dispatchEvent(new Event("textChanged"));
  422.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  423.       }
  424.       
  425.       public function get selectionEndIndex() : int
  426.       {
  427.          return !!textField ? textField.selectionEndIndex : _selectionEndIndex;
  428.       }
  429.       
  430.       [Bindable("editableChanged")]
  431.       public function get editable() : Boolean
  432.       {
  433.          return _editable;
  434.       }
  435.       
  436.       [Bindable("dataChange")]
  437.       public function get listData() : BaseListData
  438.       {
  439.          return _listData;
  440.       }
  441.       
  442.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  443.       {
  444.          switch(param1.keyCode)
  445.          {
  446.             case Keyboard.ENTER:
  447.                dispatchEvent(new FlexEvent(FlexEvent.ENTER));
  448.                if(textChanged || htmlTextChanged)
  449.                {
  450.                   validateNow();
  451.                }
  452.          }
  453.       }
  454.       
  455.       override protected function focusInHandler(param1:FocusEvent) : void
  456.       {
  457.          var fm:IFocusManager;
  458.          var message:String = null;
  459.          var event:FocusEvent = param1;
  460.          if(event.target == this)
  461.          {
  462.             systemManager.stage.focus = TextField(textField);
  463.          }
  464.          fm = focusManager;
  465.          if(editable && Boolean(fm))
  466.          {
  467.             fm.showFocusIndicator = true;
  468.             if(textField.selectable && _selectionBeginIndex == _selectionEndIndex)
  469.             {
  470.                textField.setSelection(0,textField.length);
  471.             }
  472.          }
  473.          super.focusInHandler(event);
  474.          if(_imeMode != null && _editable)
  475.          {
  476.             IME.enabled = true;
  477.             prevMode = IME.conversionMode;
  478.             try
  479.             {
  480.                if(!errorCaught && IME.conversionMode != IMEConversionMode.UNKNOWN)
  481.                {
  482.                   IME.conversionMode = _imeMode;
  483.                }
  484.                errorCaught = false;
  485.             }
  486.             catch(e:Error)
  487.             {
  488.                errorCaught = true;
  489.                message = resourceManager.getString("controls","unsupportedMode",[_imeMode]);
  490.                throw new Error(message);
  491.             }
  492.          }
  493.       }
  494.       
  495.       [NonCommittingChangeEvent("change")]
  496.       [Bindable("htmlTextChanged")]
  497.       public function get htmlText() : String
  498.       {
  499.          return _htmlText;
  500.       }
  501.       
  502.       override public function set tabIndex(param1:int) : void
  503.       {
  504.          if(param1 == _tabIndex)
  505.          {
  506.             return;
  507.          }
  508.          _tabIndex = param1;
  509.          tabIndexChanged = true;
  510.          invalidateProperties();
  511.       }
  512.       
  513.       public function set restrict(param1:String) : void
  514.       {
  515.          if(param1 == _restrict)
  516.          {
  517.             return;
  518.          }
  519.          _restrict = param1;
  520.          restrictChanged = true;
  521.          invalidateProperties();
  522.          dispatchEvent(new Event("restrictChanged"));
  523.       }
  524.       
  525.       private function textField_textFieldStyleChangeHandler(param1:Event) : void
  526.       {
  527.          textFieldChanged(true,false);
  528.       }
  529.       
  530.       private function textField_nativeDragDropHandler(param1:Event) : void
  531.       {
  532.          textField_changeHandler(param1);
  533.       }
  534.       
  535.       private function textField_changeHandler(param1:Event) : void
  536.       {
  537.          textFieldChanged(false,false);
  538.          textChanged = false;
  539.          htmlTextChanged = false;
  540.          param1.stopImmediatePropagation();
  541.          dispatchEvent(new Event(Event.CHANGE));
  542.       }
  543.       
  544.       override public function set enabled(param1:Boolean) : void
  545.       {
  546.          if(param1 == enabled)
  547.          {
  548.             return;
  549.          }
  550.          super.enabled = param1;
  551.          enabledChanged = true;
  552.          invalidateProperties();
  553.          if(Boolean(mx_internal::border) && mx_internal::border is IInvalidating)
  554.          {
  555.             IInvalidating(mx_internal::border).invalidateDisplayList();
  556.          }
  557.       }
  558.       
  559.       override public function get baselinePosition() : Number
  560.       {
  561.          var _loc1_:String = null;
  562.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  563.          {
  564.             _loc1_ = text;
  565.             if(_loc1_ == "")
  566.             {
  567.                _loc1_ = " ";
  568.             }
  569.             return (Boolean(mx_internal::border) && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics.top : 0) + measureText(_loc1_).ascent;
  570.          }
  571.          if(!mx_internal::validateBaselinePosition())
  572.          {
  573.             return NaN;
  574.          }
  575.          return textField.y + textField.baselinePosition;
  576.       }
  577.       
  578.       public function set condenseWhite(param1:Boolean) : void
  579.       {
  580.          if(param1 == _condenseWhite)
  581.          {
  582.             return;
  583.          }
  584.          _condenseWhite = param1;
  585.          condenseWhiteChanged = true;
  586.          if(isHTML)
  587.          {
  588.             htmlTextChanged = true;
  589.          }
  590.          invalidateProperties();
  591.          invalidateSize();
  592.          invalidateDisplayList();
  593.          dispatchEvent(new Event("condenseWhiteChanged"));
  594.       }
  595.       
  596.       public function get textWidth() : Number
  597.       {
  598.          return _textWidth;
  599.       }
  600.       
  601.       public function set displayAsPassword(param1:Boolean) : void
  602.       {
  603.          if(param1 == _displayAsPassword)
  604.          {
  605.             return;
  606.          }
  607.          _displayAsPassword = param1;
  608.          displayAsPasswordChanged = true;
  609.          invalidateProperties();
  610.          invalidateSize();
  611.          invalidateDisplayList();
  612.          dispatchEvent(new Event("displayAsPasswordChanged"));
  613.       }
  614.       
  615.       mx_internal function removeTextField() : void
  616.       {
  617.          if(textField)
  618.          {
  619.             textField.removeEventListener(Event.CHANGE,textField_changeHandler);
  620.             textField.removeEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  621.             textField.removeEventListener(Event.SCROLL,textField_scrollHandler);
  622.             textField.removeEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  623.             textField.removeEventListener("textFormatChange",textField_textFormatChangeHandler);
  624.             textField.removeEventListener("textInsert",textField_textModifiedHandler);
  625.             textField.removeEventListener("textReplace",textField_textModifiedHandler);
  626.             textField.removeEventListener("nativeDragDrop",textField_nativeDragDropHandler);
  627.             removeChild(DisplayObject(textField));
  628.             textField = null;
  629.          }
  630.       }
  631.       
  632.       [Bindable("dataChange")]
  633.       public function get data() : Object
  634.       {
  635.          return _data;
  636.       }
  637.       
  638.       public function set maxChars(param1:int) : void
  639.       {
  640.          if(param1 == _maxChars)
  641.          {
  642.             return;
  643.          }
  644.          _maxChars = param1;
  645.          maxCharsChanged = true;
  646.          invalidateProperties();
  647.          dispatchEvent(new Event("maxCharsChanged"));
  648.       }
  649.       
  650.       public function set horizontalScrollPosition(param1:Number) : void
  651.       {
  652.          if(param1 == _horizontalScrollPosition)
  653.          {
  654.             return;
  655.          }
  656.          _horizontalScrollPosition = param1;
  657.          horizontalScrollPositionChanged = true;
  658.          invalidateProperties();
  659.          dispatchEvent(new Event("horizontalScrollPositionChanged"));
  660.       }
  661.       
  662.       override public function setFocus() : void
  663.       {
  664.          textField.setFocus();
  665.       }
  666.       
  667.       [Bindable("restrictChanged")]
  668.       public function get restrict() : String
  669.       {
  670.          return _restrict;
  671.       }
  672.       
  673.       public function set fontContext(param1:IFlexModuleFactory) : void
  674.       {
  675.          this.moduleFactory = param1;
  676.       }
  677.       
  678.       public function set selectionBeginIndex(param1:int) : void
  679.       {
  680.          _selectionBeginIndex = param1;
  681.          selectionChanged = true;
  682.          invalidateProperties();
  683.       }
  684.       
  685.       public function set selectionEndIndex(param1:int) : void
  686.       {
  687.          _selectionEndIndex = param1;
  688.          selectionChanged = true;
  689.          invalidateProperties();
  690.       }
  691.       
  692.       private function textField_scrollHandler(param1:Event) : void
  693.       {
  694.          _horizontalScrollPosition = textField.scrollH;
  695.       }
  696.       
  697.       public function get textHeight() : Number
  698.       {
  699.          return _textHeight;
  700.       }
  701.       
  702.       public function set editable(param1:Boolean) : void
  703.       {
  704.          if(param1 == _editable)
  705.          {
  706.             return;
  707.          }
  708.          _editable = param1;
  709.          editableChanged = true;
  710.          invalidateProperties();
  711.          dispatchEvent(new Event("editableChanged"));
  712.       }
  713.       
  714.       override protected function commitProperties() : void
  715.       {
  716.          var _loc1_:int = 0;
  717.          super.commitProperties();
  718.          if(hasFontContextChanged() && textField != null)
  719.          {
  720.             _loc1_ = getChildIndex(DisplayObject(textField));
  721.             mx_internal::removeTextField();
  722.             mx_internal::createTextField(_loc1_);
  723.             accessibilityPropertiesChanged = true;
  724.             condenseWhiteChanged = true;
  725.             displayAsPasswordChanged = true;
  726.             enabledChanged = true;
  727.             maxCharsChanged = true;
  728.             restrictChanged = true;
  729.             tabIndexChanged = true;
  730.             textChanged = true;
  731.             selectionChanged = true;
  732.             horizontalScrollPositionChanged = true;
  733.          }
  734.          if(accessibilityPropertiesChanged)
  735.          {
  736.             textField.accessibilityProperties = _accessibilityProperties;
  737.             accessibilityPropertiesChanged = false;
  738.          }
  739.          if(condenseWhiteChanged)
  740.          {
  741.             textField.condenseWhite = _condenseWhite;
  742.             condenseWhiteChanged = false;
  743.          }
  744.          if(displayAsPasswordChanged)
  745.          {
  746.             textField.displayAsPassword = _displayAsPassword;
  747.             displayAsPasswordChanged = false;
  748.          }
  749.          if(enabledChanged || editableChanged)
  750.          {
  751.             textField.type = enabled && _editable ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
  752.             if(enabledChanged)
  753.             {
  754.                if(textField.enabled != enabled)
  755.                {
  756.                   textField.enabled = enabled;
  757.                }
  758.                enabledChanged = false;
  759.             }
  760.             selectableChanged = true;
  761.             editableChanged = false;
  762.          }
  763.          if(selectableChanged)
  764.          {
  765.             if(_editable)
  766.             {
  767.                textField.selectable = enabled;
  768.             }
  769.             else
  770.             {
  771.                textField.selectable = enabled && _selectable;
  772.             }
  773.             selectableChanged = false;
  774.          }
  775.          if(maxCharsChanged)
  776.          {
  777.             textField.maxChars = _maxChars;
  778.             maxCharsChanged = false;
  779.          }
  780.          if(restrictChanged)
  781.          {
  782.             textField.restrict = _restrict;
  783.             restrictChanged = false;
  784.          }
  785.          if(tabIndexChanged)
  786.          {
  787.             textField.tabIndex = _tabIndex;
  788.             tabIndexChanged = false;
  789.          }
  790.          if(textChanged || htmlTextChanged)
  791.          {
  792.             if(isHTML)
  793.             {
  794.                textField.htmlText = explicitHTMLText;
  795.             }
  796.             else
  797.             {
  798.                textField.text = _text;
  799.             }
  800.             textFieldChanged(false,true);
  801.             textChanged = false;
  802.             htmlTextChanged = false;
  803.          }
  804.          if(selectionChanged)
  805.          {
  806.             textField.setSelection(_selectionBeginIndex,_selectionEndIndex);
  807.             selectionChanged = false;
  808.          }
  809.          if(horizontalScrollPositionChanged)
  810.          {
  811.             textField.scrollH = _horizontalScrollPosition;
  812.             horizontalScrollPositionChanged = false;
  813.          }
  814.       }
  815.       
  816.       override public function styleChanged(param1:String) : void
  817.       {
  818.          var _loc2_:Boolean = param1 == null || param1 == "styleName";
  819.          super.styleChanged(param1);
  820.          if(_loc2_ || param1 == "borderSkin")
  821.          {
  822.             if(mx_internal::border)
  823.             {
  824.                removeChild(DisplayObject(mx_internal::border));
  825.                mx_internal::border = null;
  826.                createBorder();
  827.             }
  828.          }
  829.       }
  830.       
  831.       private function get isHTML() : Boolean
  832.       {
  833.          return explicitHTMLText != null;
  834.       }
  835.       
  836.       [Bindable("maxCharsChanged")]
  837.       public function get maxChars() : int
  838.       {
  839.          return _maxChars;
  840.       }
  841.       
  842.       public function get maxHorizontalScrollPosition() : Number
  843.       {
  844.          return !!textField ? textField.maxScrollH : 0;
  845.       }
  846.       
  847.       mx_internal function set selectable(param1:Boolean) : void
  848.       {
  849.          if(_selectable == param1)
  850.          {
  851.             return;
  852.          }
  853.          _selectable = param1;
  854.          selectableChanged = true;
  855.          invalidateProperties();
  856.       }
  857.       
  858.       public function get length() : int
  859.       {
  860.          return text != null ? text.length : -1;
  861.       }
  862.       
  863.       public function set listData(param1:BaseListData) : void
  864.       {
  865.          _listData = param1;
  866.       }
  867.       
  868.       private function textField_textModifiedHandler(param1:Event) : void
  869.       {
  870.          textFieldChanged(false,true);
  871.       }
  872.       
  873.       private function textField_textFormatChangeHandler(param1:Event) : void
  874.       {
  875.          textFieldChanged(true,false);
  876.       }
  877.       
  878.       public function set htmlText(param1:String) : void
  879.       {
  880.          textSet = true;
  881.          if(!param1)
  882.          {
  883.             param1 = "";
  884.          }
  885.          _htmlText = param1;
  886.          htmlTextChanged = true;
  887.          _text = null;
  888.          explicitHTMLText = param1;
  889.          invalidateProperties();
  890.          invalidateSize();
  891.          invalidateDisplayList();
  892.          dispatchEvent(new Event("htmlTextChanged"));
  893.       }
  894.       
  895.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  896.       {
  897.          var _loc3_:EdgeMetrics = null;
  898.          super.updateDisplayList(param1,param2);
  899.          if(mx_internal::border)
  900.          {
  901.             mx_internal::border.setActualSize(param1,param2);
  902.             _loc3_ = mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  903.          }
  904.          else
  905.          {
  906.             _loc3_ = EdgeMetrics.EMPTY;
  907.          }
  908.          var _loc4_:Number = getStyle("paddingLeft");
  909.          var _loc5_:Number = getStyle("paddingRight");
  910.          var _loc6_:Number = getStyle("paddingTop");
  911.          var _loc7_:Number = getStyle("paddingBottom");
  912.          var _loc8_:Number = _loc3_.left + _loc3_.right;
  913.          var _loc9_:Number = _loc3_.top + _loc3_.bottom + 1;
  914.          textField.x = _loc3_.left;
  915.          textField.y = _loc3_.top;
  916.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  917.          {
  918.             textField.x += _loc4_;
  919.             textField.y += _loc6_;
  920.             _loc8_ += _loc4_ + _loc5_;
  921.             _loc9_ += _loc6_ + _loc7_;
  922.          }
  923.          textField.width = Math.max(0,param1 - _loc8_);
  924.          textField.height = Math.max(0,param2 - _loc9_);
  925.       }
  926.       
  927.       public function getLineMetrics(param1:int) : TextLineMetrics
  928.       {
  929.          return !!textField ? textField.getLineMetrics(param1) : null;
  930.       }
  931.    }
  932. }
  933.  
  934.