//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.core { import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.Sprite; import flash.events.Event; import flash.geom.Matrix; import flash.text.TextField; import flash.text.TextFieldType; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextLineMetrics; import mx.automation.IAutomationObject; import mx.core.LayoutDirection; import mx.managers.ISystemManager; import mx.managers.IToolTipManagerClient; import mx.managers.SystemManager; import mx.managers.ToolTipManager; import mx.resources.IResourceManager; import mx.resources.ResourceManager; import mx.styles.ISimpleStyleClient; import mx.styles.IStyleClient; import mx.styles.IStyleManager2; import mx.styles.StyleManager; import mx.styles.StyleProtoChain; import mx.utils.MatrixUtil; import mx.utils.NameUtil; import mx.utils.StringUtil; use namespace mx_internal; include "../styles/metadata/LeadingStyle.as" include "../styles/metadata/PaddingStyles.as" include "../styles/metadata/TextStyles.as" //-------------------------------------- // Excluded APIs //-------------------------------------- [Exclude(name="direction", kind="style")] //-------------------------------------- // Other metadata //-------------------------------------- [ResourceBundle("core")] /** * The UITextField class defines the component used by many Flex * components to display text. * For example, the mx.controls.Button control uses a * UITextField component to define the label area of the Button control. * *
The UITextField class extends the flash.text.TextField class to * support additional functionality required by Flex, such as CSS styles, * invalidation/measurement/layout, enabling/disabling, tooltips, and IME * (Input Method Editor) support for entering Chinese, Japanese, and * Korean text.
* *Warning: if UITextField inherits layoutDirection="rtl"
, it
* will modify its own transform.matrix
to restore the default
* coordinate system locally.
"DataGridItemRenderer"
.
*
* This string does not include the package name.
* If you need the package name as well, call the
* getQualifiedClassName()
method in the flash.utils package.
* It will return a string such as
* "mx.controls.dataGridClasses::DataGridItemRenderer"
.
flash.text.TextField.type
property.
*
* @default true
* @see flash.text.TextField
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get enabled():Boolean
{
return _enabled;
}
/**
* @private
*/
public function set enabled(value:Boolean):void
{
mouseEnabled = value;
_enabled = value;
styleChanged("color");
}
//----------------------------------
// explicitHeight
//----------------------------------
/**
* @private
* Storage for the explicitHeight property.
*/
private var _explicitHeight:Number;
/**
* @copy mx.core.UIComponent#explicitHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get explicitHeight():Number
{
return _explicitHeight;
}
/**
* @private
*/
public function set explicitHeight(value:Number):void
{
_explicitHeight = value;
}
//----------------------------------
// explicitMaxHeight
//----------------------------------
/**
* Number that specifies the maximum height of the component,
* in pixels, in the component's coordinates, if the maxHeight property
* is set. Because maxHeight is read-only, this method returns NaN.
* You must override this method and add a setter to use this
* property.
*
* @see mx.core.UIComponent#explicitMaxHeight
*
* @default NaN
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get explicitMaxHeight():Number
{
return NaN;
}
//----------------------------------
// explicitMaxWidth
//----------------------------------
/**
* Number that specifies the maximum width of the component,
* in pixels, in the component's coordinates, if the maxWidth property
* is set. Because maxWidth is read-only, this method returns NaN.
* You must override this method and add a setter to use this
* property.
*
* @see mx.core.UIComponent#explicitMaxWidth
*
* @default NaN
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get explicitMaxWidth():Number
{
return NaN;
}
//----------------------------------
// explicitMinHeight
//----------------------------------
/**
* @copy mx.core.UIComponent#explicitMinHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get explicitMinHeight():Number
{
return NaN;
}
//----------------------------------
// explicitMinWidth
//----------------------------------
/**
* @copy mx.core.UIComponent#explicitMinWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get explicitMinWidth():Number
{
return NaN;
}
//----------------------------------
// explicitWidth
//----------------------------------
/**
* @private
* Storage for the explicitWidth property.
*/
private var _explicitWidth:Number;
/**
* @copy mx.core.UIComponent#explicitWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get explicitWidth():Number
{
return _explicitWidth;
}
/**
* @private
*/
public function set explicitWidth(value:Number):void
{
_explicitWidth = value;
}
//----------------------------------
// focusPane
//----------------------------------
/**
* @inheritDoc
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get focusPane():Sprite
{
return null;
}
/**
* @private
*/
public function set focusPane(value:Sprite):void
{
}
//----------------------------------
// ignorePadding
//----------------------------------
/**
* @private
* Storage for the ignorePadding property.
*/
private var _ignorePadding:Boolean = true;
/**
* If true
, the paddingLeft
and
* paddingRight
styles will not add space
* around the text of the component.
*
* @default true
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get ignorePadding():Boolean
{
return _ignorePadding;
}
/**
* @private
*/
public function set ignorePadding(value:Boolean):void
{
_ignorePadding = value;
styleChanged(null);
}
//----------------------------------
// imeMode
//----------------------------------
/**
* @private
* Storage for the imeMode property.
*/
private var _imeMode:String = null;
/**
* Specifies the IME (input method editor) mode.
* The IME enables users to enter text in Chinese, Japanese, and Korean.
* Flex sets the specified IME mode when the control gets the focus,
* and sets it back to the previous value when the control loses the focus.
*
* The flash.system.IMEConversionMode class defines constants for the
* valid values for this property.
* You can also specify null
to specify no IME.
getStyle()
method accesses
* inheritingStyles[styleName]
to search the entire
* prototype-linked chain.
* This object is set up by the initProtoChain()
method.
* You typically never need to access this property directly.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get inheritingStyles():Object
{
return _inheritingStyles;
}
/**
* @private
*/
public function set inheritingStyles(value:Object):void
{
_inheritingStyles = value;
}
//----------------------------------
// initialized
//----------------------------------
/**
* @private
* Storage for the initialize property.
*/
private var _initialized:Boolean = false;
/**
* A flag that determines if an object has been through all three phases
* of layout validation (provided that any were required)
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get initialized():Boolean
{
return _initialized;
}
/**
* @private
*/
public function set initialized(value:Boolean):void
{
_initialized = value;
}
//----------------------------------
// isHTML
//----------------------------------
/**
* @private
*/
private function get isHTML():Boolean
{
return explicitHTMLText != null;
}
//----------------------------------
// isPopUp
//----------------------------------
/**
* @copy mx.core.UIComponent#isPopUp
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get isPopUp():Boolean
{
return false;
}
/**
* @private
*/
public function set isPopUp(value:Boolean):void
{
}
//----------------------------------
// maxHeight
//----------------------------------
/**
* @copy mx.core.UIComponent#maxHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get maxHeight():Number
{
return UIComponent.DEFAULT_MAX_HEIGHT;
}
//----------------------------------
// maxWidth
//----------------------------------
/**
* @copy mx.core.UIComponent#maxWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get maxWidth():Number
{
return UIComponent.DEFAULT_MAX_WIDTH;
}
//----------------------------------
// measuredHeight
//----------------------------------
/**
* @copy mx.core.UIComponent#measuredHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get measuredHeight():Number
{
validateNow();
// If we use device fonts, then the unscaled height is
// textHeight * scaleX / scaleY
if (!stage || embedFonts)
return textHeight + TEXT_HEIGHT_PADDING;
const m:Matrix = transform.concatenatedMatrix;
return Math.abs((textHeight * m.a / m.d)) + TEXT_HEIGHT_PADDING;
}
//----------------------------------
// measuredMinHeight
//----------------------------------
/**
* @copy mx.core.UIComponent#measuredMinHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get measuredMinHeight():Number
{
return 0;
}
/**
* @private
*/
public function set measuredMinHeight(value:Number):void
{
}
//----------------------------------
// measuredMinWidth
//----------------------------------
/**
* @copy mx.core.UIComponent#measuredMinWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get measuredMinWidth():Number
{
return 0;
}
/**
* @private
*/
public function set measuredMinWidth(value:Number):void
{
}
//----------------------------------
// measuredWidth
//----------------------------------
/**
* @copy mx.core.UIComponent#measuredWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get measuredWidth():Number
{
validateNow();
// If we use device fonts, then the unscaled width is
// textWidth * scaleX / scaleY
if (!stage || embedFonts)
return textWidth + TEXT_WIDTH_PADDING;
const m:Matrix = transform.concatenatedMatrix;
return Math.abs((textWidth * m.a / m.d)) + TEXT_WIDTH_PADDING;
}
//----------------------------------
// minHeight
//----------------------------------
/**
* @copy mx.core.UIComponent#minHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get minHeight():Number
{
return 0;
}
//----------------------------------
// minWidth
//----------------------------------
/**
* @copy mx.core.UIComponent#minWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get minWidth():Number
{
return 0;
}
//----------------------------------
// moduleFactory
//----------------------------------
/**
* @private
* Storage for the moduleFactory property.
*/
private var _moduleFactory:IFlexModuleFactory;
[Inspectable(environment="none")]
/**
* The moduleFactory that is used to create TextFields in the correct SWF context. This is necessary so that
* embedded fonts will work.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get moduleFactory():IFlexModuleFactory
{
return _moduleFactory;
}
/**
* @private
*/
public function set moduleFactory(factory:IFlexModuleFactory):void
{
_moduleFactory = factory;
_styleManager = null;
}
//----------------------------------
// nestLevel
//----------------------------------
/**
* @private
* Storage for the nestLevel property.
*/
private var _nestLevel:int = 0;
/**
* @copy mx.core.UIComponent#nestLevel
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get nestLevel():int
{
return _nestLevel;
}
/**
* @private
*/
public function set nestLevel(value:int):void
{
// If my parent hasn't been attached to the display list, then its nestLevel
// will be zero. If it tries to set my nestLevel to 1, ignore it. We'll
// update nest levels again after the parent is added to the display list.
//
// Also punt if the new value for nestLevel is the same as my current value.
if (value > 1 && _nestLevel != value)
{
_nestLevel = value;
StyleProtoChain.initTextField(this);
styleChangedFlag = true;
validateNow();
}
}
//----------------------------------
// nonInheritingStyles
//----------------------------------
/**
* @private
* Storage for the nonInheritingStyles property.
*/
private var _nonInheritingStyles:Object = StyleProtoChain.STYLE_UNINITIALIZED;
/**
* The beginning of this UITextField's chain of non-inheriting styles.
* The getStyle()
method accesses
* nonInheritingStyles[styleName]
method to search the entire
* prototype-linked chain.
* This object is set up by the initProtoChain()
method.
* You typically never need to access this property directly.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get nonInheritingStyles():Object
{
return _nonInheritingStyles;
}
/**
* @private
*/
public function set nonInheritingStyles(value:Object):void
{
_nonInheritingStyles = value;
}
//----------------------------------
// percentHeight
//----------------------------------
/**
* @copy mx.core.UIComponent#percentHeight
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get percentHeight():Number
{
return NaN;
}
/**
* @private
*/
public function set percentHeight(value:Number):void
{
}
//----------------------------------
// percentWidth
//----------------------------------
/**
* @copy mx.core.UIComponent#percentWidth
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get percentWidth():Number
{
return NaN;
}
/**
* @private
*/
public function set percentWidth(value:Number):void
{
}
//----------------------------------
// processedDescriptors
//----------------------------------
/**
* @private
*/
private var _processedDescriptors:Boolean = true;
/**
* Set to true
after the createChildren()
* method creates any internal component children.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get processedDescriptors():Boolean
{
return _processedDescriptors;
}
/**
* @private
*/
public function set processedDescriptors(value:Boolean):void
{
_processedDescriptors = value;
}
//----------------------------------
// styleManager
//----------------------------------
/**
* @private
*/
private var _styleManager:IStyleManager2;
/**
* @private
*
* Returns the style manager used by this component.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4
*/
public function get styleManager():IStyleManager2
{
if (!_styleManager)
{
_styleManager = StyleManager.getStyleManager(moduleFactory);
}
return _styleManager;
}
//----------------------------------
// styleName
//----------------------------------
/**
* @private
* Storage for the styleName property.
*/
private var _styleName:Object /* String, CSSStyleDeclaration, or UIComponent */;
/**
* @copy mx.core.UIComponent#styleName
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get styleName():Object /* String, CSSStyleDeclaration, or UIComponent */
{
return _styleName;
}
/**
* @private
*/
public function set styleName(value:Object /* String, CSSStyleDeclaration, or UIComponent */):void
{
if (_styleName === value)
return;
_styleName = value;
if (parent)
{
StyleProtoChain.initTextField(this);
styleChanged("styleName");
}
// If we don't have a parent pointer yet, then we'll wait
// and initialize the proto chain when the parentChanged()
// method is called.
}
//----------------------------------
// systemManager
//----------------------------------
/**
* @copy mx.core.UIComponent#systemManager
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get systemManager():ISystemManager
{
var o:DisplayObject = parent;
while (o)
{
var ui:IUIComponent = o as IUIComponent;
if (ui)
return ui.systemManager;
o = o.parent;
}
return null;
}
/**
* @private
*/
public function set systemManager(value:ISystemManager):void
{
// Not supported
}
//----------------------------------
// nonZeroTextHeight
//----------------------------------
/**
* Unlike textHeight, this returns a non-zero value
* even when the text is empty.
* In this case, it returns what the textHeight would be
* if the text weren't empty.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get nonZeroTextHeight():Number
{
if (super.text == "")
{
super.text = "Wj";
var result:Number = textHeight;
super.text = "";
return result;
}
return textHeight;
}
//----------------------------------
// textHeight
//----------------------------------
/**
* @private
* TextField does not take into account the leading on the final
* line of text when measuring itself, yet will scroll if it is
* not given this extra height. This is a player bug bug that
* has been retired.
*/
override public function get textHeight():Number
{
var result:Number = super.textHeight;
if (numLines > 1)
result += getLineMetrics(1).leading;
return result;
}
//----------------------------------
// toolTip
//----------------------------------
/**
* @private
* Storage for the toolTip property.
*/
mx_internal var _toolTip:String;
/**
* @copy mx.core.UIComponent#toolTip
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get toolTip():String
{
return _toolTip;
}
/**
* @private
*/
public function set toolTip(value:String):void
{
var oldValue:String = _toolTip;
_toolTip = value;
ToolTipManager.registerToolTip(this, oldValue, value);
}
//----------------------------------
// tweeningProperties
//----------------------------------
/**
* @copy mx.core.UIComponent#tweeningProperties
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get tweeningProperties():Array
{
return null;
}
/**
* @private
*/
public function set tweeningProperties(value:Array):void
{
}
//----------------------------------
// updateCompletePendingFlag
//----------------------------------
/**
* @private
* Storage for the updateCompletePendingFlag property.
*/
private var _updateCompletePendingFlag:Boolean = false;
/**
* A flag that determines if an object has been through all three phases
* of layout validation (provided that any were required)
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get updateCompletePendingFlag():Boolean
{
return _updateCompletePendingFlag;
}
/**
* @private
*/
public function set updateCompletePendingFlag(value:Boolean):void
{
_updateCompletePendingFlag = value;
}
//--------------------------------------------------------------------------
//
// Overridden methods: TextField
//
//--------------------------------------------------------------------------
/**
* @private
*/
override public function setTextFormat(format:TextFormat,
beginIndex:int = -1,
endIndex:int = -1):void
{
// It is an exception to call setTextFormat()
// when styleSheet is applied.
if (styleSheet)
return;
super.setTextFormat(format, beginIndex, endIndex);
// Since changing the TextFormat will change the htmlText,
// dispatch an event so that listeners can react to this.
dispatchEvent(new Event("textFormatChange"));
}
/**
* @private
*/
override public function insertXMLText(beginIndex:int, endIndex:int,
richText:String,
pasting:Boolean = false):void
{
super.insertXMLText(beginIndex, endIndex, richText, pasting);
dispatchEvent(new Event("textInsert"));
}
/**
* @private
*/
override public function replaceText(beginIndex:int, endIndex:int,
newText:String):void
{
super.replaceText(beginIndex, endIndex, newText);
dispatchEvent(new Event("textReplace"));
}
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
/**
* Initializes this component.
*
* This method is required by the IUIComponent interface, * but it actually does nothing for a UITextField.
* * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function initialize():void { } /** * @copy mx.core.UIComponent#getExplicitOrMeasuredWidth() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function getExplicitOrMeasuredWidth():Number { return !isNaN(explicitWidth) ? explicitWidth : measuredWidth; } /** * @copy mx.core.UIComponent#getExplicitOrMeasuredHeight() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function getExplicitOrMeasuredHeight():Number { return !isNaN(explicitHeight) ? explicitHeight : measuredHeight; } /** * Sets thevisible
property of this UITextField object.
*
* @param visible true
to make this UITextField visible,
* and false
to make it invisible.
*
* @param noEvent true
to suppress generating an event when you change visibility.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function setVisible(visible:Boolean, noEvent:Boolean = false):void
{
this.visible = visible
}
/**
* @copy mx.core.UIComponent#setFocus()
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function setFocus():void
{
systemManager.stage.focus = this;
}
/**
* Returns a UITextFormat object that contains formatting information for this component.
* This method is similar to the getTextFormat()
method of the
* flash.text.TextField class, but it returns a UITextFormat object instead
* of a TextFormat object.
*
* The UITextFormat class extends the TextFormat class to add the text measurement methods
* measureText()
and measureHTMLText()
.
null
, a localizable string
* such as "..."
will be used.
*
* @return true
if the text needed truncation.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function truncateToFit(truncationIndicator:String = null):Boolean
{
if (!truncationIndicator)
truncationIndicator = truncationIndicatorResource;
// Ensure that the proper CSS styles get applied to the textField
// before measuring text.
// Otherwise the callLater(validateNow) in styleChanged()
// can apply the CSS styles too late.
validateNow();
var originalText:String = super.text;
untruncatedText = originalText;
var w:Number = width;
// Need to check if we should truncate, but it
// could be due to rounding error. Let's check that it's not.
// Examples of rounding errors happen with "South Africa" and "Game"
// with verdana.ttf.
if (originalText != "" && textWidth + TEXT_WIDTH_PADDING > w + 0.00000000000001)
{
// This should get us into the ballpark.
var s:String = super.text = originalText;
originalText.slice(0,
Math.floor((w / (textWidth + TEXT_WIDTH_PADDING)) * originalText.length));
while (s.length > 1 && textWidth + TEXT_WIDTH_PADDING > w)
{
s = s.slice(0, -1);
super.text = s + truncationIndicator;
}
return true;
}
return false;
}
//--------------------------------------------------------------------------
//
// Event handlers
//
//--------------------------------------------------------------------------
/**
* @private
*/
private function changeHandler(event:Event):void
{
// If the user changes the text displayed by the TextField,
// whatever htmlText might have been set is now irrelevant.
// This means that we can no longer re-apply any HTML markup
// after a CSS style change.
explicitHTMLText = null;
}
/**
* @private
*/
private function textFieldStyleChangeHandler(event:Event):void
{
// Some TextFormat in the TextField just changed.
// If the TextField is displaying htmlText we need
// to reset the htmlText that was last set
// so that its markup is applied on top of the new TextFormat.
if (explicitHTMLText != null)
super.htmlText = explicitHTMLText;
}
/**
* @private
*/
private function resourceManager_changeHandler(event:Event):void
{
truncationIndicatorResource = resourceManager.getString(
"core", "truncationIndicator");
if (untruncatedText != null)
{
super.text = untruncatedText;
truncateToFit();
}
}
//--------------------------------------------------------------------------
//
// IUIComponent
//
//--------------------------------------------------------------------------
/**
* Returns true
if the child is parented or owned by this object.
*
* @param child The child DisplayObject.
*
* @return true
if the child is parented or owned by this UITextField object.
*
* @see #owner
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function owns(child:DisplayObject):Boolean
{
return child == this;
}
//----------------------------------
// owner
//----------------------------------
/**
* @private
*/
private var _owner:DisplayObjectContainer;
/**
* By default, set to the parent container of this object.
* However, if this object is a child component that is
* popped up by its parent, such as the dropdown list of a ComboBox control,
* the owner is the component that popped up this object.
*
* This property is not managed by Flex, but by each component.
* Therefore, if you use the PopUpManger.createPopUp()
or
* PopUpManger.addPopUp()
method to pop up a child component,
* you should set the owner
property of the child component
* to the component that popped it up.
The default value is the value of the parent
property.