Packagemx.controls
Classpublic class RichTextEditor
InheritanceRichTextEditor Inheritance Panel Inheritance Container Inheritance UIComponent Inheritance FlexSprite Inheritance Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object

The RichTextEditor control lets users enter and format text. The text characteristics that users can vary include the font family, color, size, and style, and other properties such as text alignment, bullets and URL links. The control consists of a Panel control with two direct children:

The RichTextEditor has a default height and width of 300 by 325 pixels and a default minimum height and width of 200 by 220 pixels. If you put a RichTextEditor control in a DividedBox control, make sure that the DividedBox control is large enough to contain the RichTextEditor control at its minimum dimensions. Also, you can explicitly set the RichTextEditor control's minHeight or minWidth property to NaN to let the DividedBox container reduce the control's dimensions to 0.

The following table describes the subcontrols that you can access and modify:

Control Type IDDescription
TextAreatextAreaArea where the user can enter text.
ContainertoolbarThe container for the formatting controls; puts the controls in a single horizontal row, if they fit, or multiple rows, otherwise.
ComboBoxfontFamilyComboSpecifies the text font family. The ComboBox dataProvider is an Array of Strings with the following values:
  • _sans
  • _serif
  • _typewriter
  • Arial
  • Courier
  • Courier New
  • Geneva
  • Georgia
  • Helvetica
  • Times New Roman
  • Times
  • Verdana (default)
ComboBoxfontSizeComboSpecifies the font size. The ComboBox dataProvider is an Array of Strings with the following values: 8, 9, 10 (default), 11, 12, 14, 16, 18, 20, 24, 26, 28, 36, 48, 72.

Note:This specification is the actual pixel value for the font size. These sizes are not equivalent to the relative font sizes specified in HTML using the size attribute of the <font> tag.

HBoxtoolBar2Contains the font characteristic buttons.
ButtonboldButtonWhen toggled to selected="true", sets the font to bold.
ButtonitalicButtonWhen toggled to selected="true", sets the font to italic.
ButtonunderlineButtonWhen toggled to selected="true", sets the font to underlined.
ColorPickercolorPickerSpecifies the color of the text.
ToggleButtonBaralignButtonsSpecifies the text alignment. The control's data provider consists of an Array Of objects, with the object action field specifying the justification type. The available actions are as follows:
  • left (default)
  • center
  • right
  • justify
ButtonbulletButtonWhen toggled to selected="true", sets the current line, or the selected line, to a list item, preceded by a bullet.
TextInputlinkTextInputThis field is enabled only when text is selected. When the user enters a URL in this field and presses the Enter key, Flex inserts the equivalent of an HTML <a href="user_text" target="blank"></a> tag in the TextArea subcontrol at around the currently selected text.

Flex initially fills this control with the text specified by the defaultLinkProtocol property; users can append the rest of the link to this text, or replace it.

To access one of the subcontrols, you can use syntax similar to the following:

  myRTE.toolBar2.setStyle("backgroundColor", 0xCC6633);
  

The RichTextEditor control has the following default sizing characteristics:

CharacteristicDescription
Default size325 pixels wide by 300 pixels high
Minimum size220 pixels wide by 200 pixels high
Maximum size10000 by 10000 pixels

MXML SyntaxexpandedHide MXML Syntax

The <mx:RichTextEditor> tag inherits all the members of its parent and adds the following members:

   <RichTextEditor
     Properties
     defaultLinkProtocol="http://"
     htmlText=""
     showControlBar="true | false"
     showToolTips="false | true"
     text=""
       
     Events
     change
   />
  

View the examples

See also

mx.containers.ControlBar
mx.containers.Panel
mx.controls.ToggleButtonBar
mx.controls.Button
mx.controls.ColorPicker
mx.controls.ComboBox
mx.controls.TextArea
mx.controls.TextInput
Using Text Controls


Public Properties
 PropertyDefined By
 InheritedaccessibilityProperties : AccessibilityProperties
The current accessibility options for this display object.
DisplayObject
 InheritedactiveEffects : Array
[read-only] The list of effects that are currently playing on the component, as an Array of EffectInstance instances.
UIComponent
  alignToolTip : String
The ToolTip that appears when the user hovers over the text alignment buttons.
RichTextEditor
 Inheritedalpha : Number
Indicates the alpha transparency value of the object specified.
DisplayObject
 InheritedautoLayout : Boolean
If true, measurement and layout are done when the position or size of a child is changed.
Container
 InheritedautomationDelegate : Object
The delegate object that handles the automation-related functionality.
UIComponent
 InheritedautomationName : String
Name that can be used as an identifier for this object.
UIComponent
 InheritedautomationTabularData : Object
[read-only] An implementation of the IAutomationTabularData interface, which can be used to retrieve the data.
UIComponent
 InheritedautomationValue : Array
[read-only] This value generally corresponds to the rendered appearance of the object and should be usable for correlating the identifier with the object as it appears visually within the application.
UIComponent
 InheritedbaselinePosition : Number
[read-only] The y-coordinate of the baseline of the first line of text of the component.
UIComponent
 InheritedblendMode : String
A value from the BlendMode class that specifies which blend mode to use.
DisplayObject
  boldToolTip : String
The ToolTip that appears when the user hovers over the text bold button.
RichTextEditor
 InheritedborderMetrics : EdgeMetrics
[read-only] Returns an EdgeMetrics object that has four properties: left, top, right, and bottom.
Container
  bulletToolTip : String
The ToolTip that appears when the user hovers over the bulleted list button.
RichTextEditor
 InheritedbuttonMode : Boolean
Specifies the button mode of this sprite.
Sprite
 InheritedcacheAsBitmap : Boolean
If set to true, Flash Player or Adobe AIR caches an internal bitmap representation of the display object.
DisplayObject
 InheritedcacheHeuristic : Boolean
[write-only] Used by Flex to suggest bitmap caching for the object.
UIComponent
 InheritedcachePolicy : String
Specifies the bitmap caching policy for this object.
UIComponent
 InheritedchildDescriptors : Array
[read-only] Array of UIComponentDescriptor objects produced by the MXML compiler.
Container
 InheritedclassName : String
[read-only] The name of this instance's class, such as "Button".
UIComponent
 InheritedclipContent : Boolean
Whether to apply a clip mask if the positions and/or sizes of this container's children extend outside the borders of this container.
Container
  colorPickerToolTip : String
The ToolTip that appears when the user hovers over the ColorPicker control.
RichTextEditor
 InheritedconstraintColumns : Array
An Array of ConstraintColumn instances that partition this container.
Panel
 InheritedconstraintRows : Array
An Array of ConstraintRow instances that partition this container.
Panel
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcontentMouseX : Number
[read-only] Returns the x position of the mouse, in the content coordinate system.
Container
 InheritedcontentMouseY : Number
[read-only] Returns the y position of the mouse, in the content coordinate system.
Container
 InheritedcontextMenu : NativeMenu
Specifies the context menu associated with this object.
InteractiveObject
 InheritedcreatingContentPane : Boolean
Containers use an internal content pane to control scrolling.
Container
 InheritedcreationIndex : int
Specifies the order to instantiate and draw the children of the container.
Container
 InheritedcreationPolicy : String
The child creation policy for this Container.
Container
 InheritedcurrentState : String
The current view state of the component.
UIComponent
 InheritedcursorManager : ICursorManager
[read-only] Gets the CursorManager that controls the cursor for this component and its peers.
UIComponent
 Inheriteddata : Object
The data property lets you pass a value to the component when you use it in an item renderer or item editor.
Container
 InheriteddefaultButton : IFlexDisplayObject
The Button control designated as the default button for the container.
Container
  defaultLinkProtocol : String
The default protocol string to use at the start of link text.
RichTextEditor
 Inheriteddescriptor : UIComponentDescriptor
Reference to the UIComponentDescriptor, if any, that was used by the createComponentFromDescriptor() method to create this UIComponent instance.
UIComponent
 Inheriteddocument : Object
A reference to the document object associated with this UIComponent.
UIComponent
 InheriteddoubleClickEnabled : Boolean
Specifies whether the UIComponent object receives doubleClick events.
UIComponent
 InheriteddropTarget : DisplayObject
[read-only] Specifies the display object over which the sprite is being dragged, or on which the sprite was dropped.
Sprite
 Inheritedenabled : Boolean
Whether the component can accept user interaction.
UIComponent
 InheritederrorString : String
The text that will be displayed by a component's error tip when a component is monitored by a Validator and validation fails.
UIComponent
 InheritedexplicitHeight : Number
Number that specifies the explicit height of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedexplicitMaxHeight : Number
Number that specifies the maximum height of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedexplicitMaxWidth : Number
Number that specifies the maximum width of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedexplicitMinHeight : Number
Number that specifies the minimum height of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedexplicitMinWidth : Number
Number that specifies the minimum width of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedexplicitWidth : Number
Number that specifies the explicit width of the component, in pixels, in the component's coordinates.
UIComponent
 Inheritedfilters : Array
An indexed array that contains each filter object currently associated with the display object.
DisplayObject
 InheritedflexContextMenu : IFlexContextMenu
The context menu for this UIComponent.
UIComponent
 InheritedfocusEnabled : Boolean
Indicates whether the component can receive focus when tabbed to.
UIComponent
 InheritedfocusManager : IFocusManager
Gets the FocusManager that controls focus for this component and its peers.
UIComponent
 InheritedfocusPane : Sprite
The focus pane associated with this object.
UIComponent
 InheritedfocusRect : Object
Specifies whether this object displays a focus rectangle.
InteractiveObject
 InheritedfontContext : IFlexModuleFactory
The module factory that provides the font context for this component.
Panel
  fontFamilyToolTip : String
The ToolTip that appears when the user hovers over the font drop-down list.
RichTextEditor
  fontSizeToolTip : String
The ToolTip that appears when the user hovers over the font size drop-down list.
RichTextEditor
 Inheritedgraphics : Graphics
[read-only] Specifies the Graphics object that belongs to this sprite where vector drawing commands can occur.
Sprite
 Inheritedheight : Number
Number that specifies the height of the component, in pixels, in the parent's coordinates.
UIComponent
 InheritedhitArea : Sprite
Designates another sprite to serve as the hit area for a sprite.
Sprite
 InheritedhorizontalLineScrollSize : Number
Number of pixels to move when the left- or right-arrow button in the horizontal scroll bar is pressed.
Container
 InheritedhorizontalPageScrollSize : Number
Number of pixels to move when the track in the horizontal scroll bar is pressed.
Container
 InheritedhorizontalScrollBar : ScrollBar
The horizontal scrollbar used in this container.
Container
 InheritedhorizontalScrollPolicy : String
Specifies whether the horizontal scroll bar is always present, always absent, or automatically added when needed.
Container
 InheritedhorizontalScrollPosition : Number
The current position of the horizontal scroll bar.
Container
  htmlText : String
Text containing HTML markup that displays in the RichTextEditor control's TextArea subcontrol.
RichTextEditor
 Inheritedicon : Class
The Class of the icon displayed by some navigator containers to represent this Container.
Container
 Inheritedid : String
ID of the component.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether this component is included in the layout of the parent container.
UIComponent
 InheritedinheritingStyles : Object
The beginning of this component's chain of inheriting styles.
UIComponent
 Inheritedinitialized : Boolean
A flag that determines if an object has been through all three phases of layout: commitment, measurement, and layout (provided that any were required).
UIComponent
 InheritedinstanceIndex : int
[read-only] The index of a repeated component.
UIComponent
 InheritedinstanceIndices : Array
An Array containing the indices required to reference this UIComponent object from its parent document.
UIComponent
 InheritedisDocument : Boolean
[read-only] Determines whether this UIComponent instance is a document object, that is, whether it is at the top of the hierarchy of a Flex application, MXML component, or ActionScript component.
UIComponent
 InheritedisPopUp : Boolean
Set to true by the PopUpManager to indicate that component has been popped up.
UIComponent
  italicToolTip : String
The ToolTip that appears when the user hovers over the text italic button.
RichTextEditor
 Inheritedlabel : String
The text displayed by some navigator containers to represent this Container.
Container
 Inheritedlayout : String
Specifies the layout mechanism used for this container.
Panel
  linkToolTip : String
The ToolTip that appears when the user hovers over the link text input field.
RichTextEditor
 InheritedloaderInfo : LoaderInfo
[read-only] Returns a LoaderInfo object containing information about loading the file to which this display object belongs.
DisplayObject
 Inheritedmask : DisplayObject
The calling display object is masked by the specified mask object.
DisplayObject
 InheritedmaxHeight : Number
Number that specifies the maximum height of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedmaxHorizontalScrollPosition : Number
[read-only] The largest possible value for the horizontalScrollPosition property.
Container
 InheritedmaxVerticalScrollPosition : Number
[read-only] The largest possible value for the verticalScrollPosition property.
Container
 InheritedmaxWidth : Number
Number that specifies the maximum width of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedmeasuredHeight : Number
The default height of the component, in pixels.
UIComponent
 InheritedmeasuredMinHeight : Number
The default minimum height of the component, in pixels.
UIComponent
 InheritedmeasuredMinWidth : Number
The default minimum width of the component, in pixels.
UIComponent
 InheritedmeasuredWidth : Number
The default width of the component, in pixels.
UIComponent
 InheritedminHeight : Number
Number that specifies the minimum height of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedminWidth : Number
Number that specifies the minimum width of the component, in pixels, in the component's coordinates.
UIComponent
 InheritedmoduleFactory : IFlexModuleFactory
The moduleFactory that is used to create TextFields in the correct SWF context.
UIComponent
 InheritedmouseChildren : Boolean
Determines whether or not the children of the object are mouse enabled.
DisplayObjectContainer
 InheritedmouseEnabled : Boolean
Specifies whether this object receives mouse messages.
InteractiveObject
 InheritedmouseFocusEnabled : Boolean
Whether you can receive focus when clicked on.
UIComponent
 InheritedmouseX : Number
[read-only] Indicates the x coordinate of the mouse position, in pixels.
DisplayObject
 InheritedmouseY : Number
[read-only] Indicates the y coordinate of the mouse position, in pixels.
DisplayObject
 Inheritedname : String
Indicates the instance name of the DisplayObject.
DisplayObject
 InheritednestLevel : int
Depth of this object in the containment hierarchy.
UIComponent
 InheritednonInheritingStyles : Object
The beginning of this component's chain of non-inheriting styles.
UIComponent
 InheritednumAutomationChildren : int
[read-only] The number of automation children this container has.
UIComponent
 InheritednumChildren : int
[read-only] Number of child components in this container.
Container
 InheritedopaqueBackground : Object
Specifies whether the display object is opaque with a certain background color.
DisplayObject
 Inheritedowner : DisplayObjectContainer
The owner of this UIComponent.
UIComponent
 Inheritedparent : DisplayObjectContainer
[read-only] The parent container or component for this component.
UIComponent
 InheritedparentApplication : Object
[read-only] A reference to the Application object that contains this UIComponent instance.
UIComponent
 InheritedparentDocument : Object
[read-only] A reference to the parent document object for this UIComponent.
UIComponent
 InheritedpercentHeight : Number
Number that specifies the height of a component as a percentage of its parent's size.
UIComponent
 InheritedpercentWidth : Number
Number that specifies the width of a component as a percentage of its parent's size.
UIComponent
 InheritedprocessedDescriptors : Boolean
Set to true after immediate or deferred child creation, depending on which one happens.
UIComponent
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 InheritedrawChildren : IChildList
[read-only] A container typically contains child components, which can be enumerated using the Container.getChildAt() method and Container.numChildren property.
Container
 Inheritedrepeater : IRepeater
[read-only] A reference to the Repeater object in the parent document that produced this UIComponent.
UIComponent
 InheritedrepeaterIndex : int
[read-only] The index of the item in the data provider of the Repeater that produced this UIComponent.
UIComponent
 InheritedrepeaterIndices : Array
An Array containing the indices of the items in the data provider of the Repeaters in the parent document that produced this UIComponent.
UIComponent
 Inheritedrepeaters : Array
An Array containing references to the Repeater objects in the parent document that produced this UIComponent.
UIComponent
 Inheritedroot : DisplayObject
[read-only] For a display object in a loaded SWF file, the root property is the top-most display object in the portion of the display list's tree structure represented by that SWF file.
DisplayObject
 Inheritedrotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation.
DisplayObject
 Inheritedscale9Grid : Rectangle
The current scaling grid that is in effect.
DisplayObject
 InheritedscaleX : Number
Number that specifies the horizontal scaling factor.
UIComponent
 InheritedscaleY : Number
Number that specifies the vertical scaling factor.
UIComponent
 Inheritedscreen : Rectangle
[read-only] Returns an object that contains the size and position of the base drawing surface for this object.
UIComponent
 InheritedscrollRect : Rectangle
The scroll rectangle bounds of the display object.
DisplayObject
  selection : TextRange
[read-only] A TextRange object containing the selected text in the TextArea subcontrol.
RichTextEditor
  showControlBar : Boolean
Specifies whether to display the control bar that contains the text formatting controls.
RichTextEditor
 InheritedshowInAutomationHierarchy : Boolean
A flag that determines if an automation object shows in the automation hierarchy.
UIComponent
  showToolTips : Boolean
Specifies whether to display tooltips for the text formatting controls.
RichTextEditor
 InheritedsoundTransform : SoundTransform
Controls sound within this sprite.
Sprite
 Inheritedstage : Stage
[read-only] The Stage of the display object.
DisplayObject
 Inheritedstates : Array
The view states that are defined for this component.
UIComponent
 Inheritedstatus : String
Text in the status area of the title bar.
Panel
 InheritedstyleDeclaration : CSSStyleDeclaration
Storage for the inline inheriting styles on this object.
UIComponent
 InheritedstyleName : Object
The class style used by this component.
UIComponent
 InheritedsystemManager : ISystemManager
Returns the SystemManager object used by this component.
UIComponent
 InheritedtabChildren : Boolean
Determines whether the children of the object are tab enabled.
DisplayObjectContainer
 InheritedtabEnabled : Boolean
Specifies whether this object is in the tab order.
InteractiveObject
 InheritedtabIndex : int
Specifies the tab ordering of objects in a SWF file.
InteractiveObject
  text : String
Plain text without markup that displays in the RichTextEditor control's TextArea subcontrol.
RichTextEditor
 InheritedtextSnapshot : TextSnapshot
[read-only] Returns a TextSnapshot object for this DisplayObjectContainer instance.
DisplayObjectContainer
 Inheritedtitle : String
Title or caption displayed in the title bar.
Panel
 InheritedtitleIcon : Class
The icon displayed in the title bar.
Panel
 InheritedtoolTip : String
Text to display in the ToolTip.
UIComponent
 Inheritedtransform : Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds.
DisplayObject
 Inheritedtransitions : Array
An Array of Transition objects, where each Transition object defines a set of effects to play when a view state change occurs.
UIComponent
 InheritedtweeningProperties : Array
Array of properties that are currently being tweened on this object.
UIComponent
 Inheriteduid : String
A unique identifier for the object.
UIComponent
  underlineToolTip : String
The ToolTip that appears when the user hovers over the text underline button.
RichTextEditor
 InheritedupdateCompletePendingFlag : Boolean
A flag that determines if an object has been through all three phases of layout validation (provided that any were required).
UIComponent
 InheriteduseHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the mouse rolls over a sprite in which the buttonMode property is set to true.
Sprite
 InheritedvalidationSubField : String
Used by a validator to associate a subfield with this component.
UIComponent
 InheritedverticalLineScrollSize : Number
Number of pixels to scroll when the up- or down-arrow button in the vertical scroll bar is pressed, or when you scroll by using the mouse wheel.
Container
 InheritedverticalPageScrollSize : Number
Number of pixels to scroll when the track in the vertical scroll bar is pressed.
Container
 InheritedverticalScrollBar : ScrollBar
The vertical scrollbar used in this container.
Container
 InheritedverticalScrollPolicy : String
Specifies whether the vertical scroll bar is always present, always absent, or automatically added when needed.
Container
 InheritedverticalScrollPosition : Number
The current position of the vertical scroll bar.
Container
 InheritedviewMetrics : EdgeMetrics
[read-only] Returns an object that has four properties: left, top, right, and bottom.
Container
 InheritedviewMetricsAndPadding : EdgeMetrics
[read-only] Returns an object that has four properties: left, top, right, and bottom.
Container
 Inheritedvisible : Boolean
Controls the visibility of this UIComponent.
UIComponent
 Inheritedwidth : Number
Number that specifies the width of the component, in pixels, in the parent's coordinates.
UIComponent
 Inheritedx : Number
Number that specifies the component's horizontal position, in pixels, within its parent container.
UIComponent
 Inheritedy : Number
Number that specifies the component's vertical position, in pixels, within its parent container.
UIComponent
Protected Properties
 PropertyDefined By
 InheritedactualCreationPolicy : String
The creation policy of this container.
Container
 InheritedcloseButtonStyleFilters : Object
[read-only]   The set of styles to pass from the Panel to the close button.
Panel
 InheritedcontrolBar : IUIComponent
A reference to this Panel container's control bar, if any.
Panel
 InheritedresourceManager : IResourceManager
[write-only] A reference to the object which manages all of the application's localized resources.
UIComponent
 InheritedstatusTextField : IUITextField
The UITextField sub-control that displays the status.
Panel
 InheritedtitleBar : UIComponent
The TitleBar sub-control that displays the Panel container's title bar.
Panel
 InheritedtitleTextField : IUITextField
The UITextField sub-control that displays the title.
Panel
 InheritedunscaledHeight : Number
[read-only] A convenience method for determining the unscaled height of the component.
UIComponent
 InheritedunscaledWidth : Number
[read-only] A convenience method for determining the unscaled width of the component All of a component's drawing and child layout should be done within a bounding rectangle of this width, which is also passed as an argument to updateDisplayList().
UIComponent
Public Methods