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