Hiding nested controls in a Flex RichTextEditor control (remix)
In a previous example, Hiding nested controls in a Flex RichTextEditor control, we looked at how you could hide and remove the nested link text input control within a RichTextEditor control in Flex. The following example extends the example somewhat by allowing you to remove any of the nested controls (including the VRule controls) in in the tool bar by setting the nested control’s visible property to false, as seen in the following snippet:
richTextEditor.colorPicker.visible = false;
<?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2007/12/04/hiding-nested-controls-in-a-flex-richtexteditor-control-remix/ --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"> <mx:Script> <![CDATA[ import mx.controls.CheckBox; private function checkBox_change(evt:Event):void { var ch:CheckBox = evt.currentTarget as CheckBox; richTextEditor[ch.data].visible = ch.selected; } ]]> </mx:Script> <mx:ApplicationControlBar dock="true" verticalAlign="top"> <mx:Form styleName="plain"> <mx:FormItem label="fontFamilyCombo.visible:"> <mx:CheckBox selected="true" data="fontFamilyCombo" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="fontSizeCombo.visible:"> <mx:CheckBox selected="true" data="fontSizeCombo" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="toolBar2.visible:"> <mx:CheckBox selected="true" data="toolBar2" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="colorPicker.visible:"> <mx:CheckBox selected="true" data="colorPicker" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="alignButtons.visible:"> <mx:CheckBox selected="true" data="alignButtons" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="bulletButton.visible:"> <mx:CheckBox selected="true" data="bulletButton" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="linkTextInput.visible:"> <mx:CheckBox selected="true" data="linkTextInput" change="checkBox_change(event);" /> </mx:FormItem> </mx:Form> <mx:Spacer width="100%" /> <mx:Form styleName="plain"> <mx:FormItem label="_RichTextEditor_VRule1.visible:"> <mx:CheckBox selected="true" data="_RichTextEditor_VRule1" change="checkBox_change(event);" /> </mx:FormItem> <mx:FormItem label="_RichTextEditor_VRule2.visible:"> <mx:CheckBox selected="true" data="_RichTextEditor_VRule2" change="checkBox_change(event);" /> </mx:FormItem> </mx:Form> </mx:ApplicationControlBar> <mx:RichTextEditor id="richTextEditor" width="100%" height="100%" /> </mx:Application>
View source is enabled in the following example.
Peter deHaan
Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.
-
Add Widgets (Content Sidebar)
This is your Content Sidebar. Edit this content that appears here in the widgets panel by adding or removing widgets in the Content Sidebar area.
9 Responses to Hiding nested controls in a Flex RichTextEditor control (remix)
Leave a Reply Cancel reply
-
Categories
- Accordion
- AccordionHeader
- ActionScript
- AddChild
- AdvancedDataGrid
- Alert
- alpha
- Animate
- AnimateProperties
- Application
- Application (Spark)
- ArrayCollection
- BarChart
- baseColor
- beta
- beta1
- beta2
- Bitmap
- Bitmap/BitmapData
- BitmapData
- BitmapFill
- BitmapFill (Spark)
- BitmapGraphic
- BitmapImage
- BitmapImage (Spark)
- BitmapImageResizeMode
- Border (Spark)
- BorderContainer (Spark)
- Box
- BuildInfo
- Button
- Button (Spark)
- ButtonBar
- ButtonBar (Spark)
- ByteArray
- Camera
- Charting
- CheckBox
- CheckBox (Spark)
- ClassFactory
- CollectionEvent
- Color
- ColorPicker
- ColorUtil
- ComboBox
- ComboBoxArrowSkin
- Compiler
- Component
- Component (Spark)
- Configuration
- Container
- ContextMenu
- ContextMenuEvent
- ContextMenuItem
- CSSCondition
- CSSSelector
- CSSStyleDeclaration
- CurrencyFormatter
- CursorManager
- Data Binding
- DataGrid
- DataGrid (Spark)
- DataGridColumn
- Date
- DateBase
- DateChooser
- DateField
- DateFormatter
- Debugging
- DefaultComplexItemRenderer
- DefaultTileListEffect
- DropDownList
- DropDownList (Spark)
- DropDownListButtonSkin
- DropDownListSkin
- DropShadowFilter
- E4X
- Effects
- Ellipse
- EmailValidator
- Embed
- Event
- Fade
- FileFilter
- FileReference
- fill
- Filters
- Flash
- Flash Integration
- FlashVars
- Flex 3 SDK
- Flex Builder
- Flex Builder 3
- Flex SDK
- Flex4
- FLVPlayback
- FocusManager
- FontLookup
- Fonts
- Form
- Form (Spark)
- FormHeading (Spark)
- FormItem
- FormItem (Spark)
- Forms
- FTETextField (Spark)
- FullScreen
- FullScreenEvent
- FxAnimateColor
- FxButtonBar
- FxCheckBox
- FXG
- FxHScrollBar
- FxHSlider
- FxList
- FxNumericStepper
- FxRadioButton
- FxRotate3D
- FxScroller
- FxTextArea
- FxTextInput
- FxToggleButton
- FxVScrollBar
- FxVSlider
- getStyleDeclaration()
- GradientEntry
- Graphic (Spark)
- HBox
- HDividedBox
- HGroup (Spark)
- HorizontalLayout
- HorizontalList
- HSBColor (Spark)
- HScrollBar (Spark)
- HSlider
- HSlider (Spark)
- HTML template
- ID3Info
- Image
- Image (Spark)
- ImageSnapshot
- itemRenderer
- JointStyle
- Label
- Label (Spark)
- Legend
- LegendItem
- LigatureLevel
- Line
- LinearGradientStroke
- LineScaleMode
- LinkBar
- LinkButton
- List
- List (Spark)
- Menu
- MenuBar
- Metadata
- MetadataEvent
- Model
- Mouse
- MouseCursor
- MouseEvent
- Move
- Namespace
- NavigatorContent (Spark)
- needsSWF
- NetConnection
- NetStream
- Nightly Builds
- NumberBaseRoundType
- NumberFormatter
- NumberValidator
- NumericCompare
- NumericStepper
- NumericStepper (Spark)
- ObjectProxy
- ObjectUtil
- paddingLeft
- paddingRight
- Panel
- Panel (Spark)
- Parallel
- Path
- PieChart
- PieSeries
- PieSeriesItem
- PopUpAnchor (Spark)
- PopUpButton
- PopUpManager
- ProgrammaticSkin
- ProgressBar
- PropertyChangeEvent
- QName
- RadialGradient
- RadioButton
- RadioButton (Spark)
- RadioButtonGroup
- RadioButtonGroup (Spark)
- Rect
- RegExp
- Regular Expressions
- Repeater
- RichEditableText
- RichText
- RichText (Spark)
- RichTextEditor
- Rotate
- Rotate3D (Spark)
- Scroller (Spark)
- Sequence
- setStyle()
- SimpleText
- SimpleText (Spark)
- skinClass
- Slider
- SliderEvent
- SolidColor
- SolidColorStroke
- Sort
- SortField
- Sound
- SoundEffect
- Spinner (Spark)
- SpriteVisualElement (Spark)
- StageDisplayState
- States
- StringUtil
- StringValidator
- StyleManager
- Styles
- SWFLoader
- SWFObject
- System
- SystemManager
- TabBar
- TabBar (Spark)
- TabNavigator
- TabStopFormat
- Text
- Text Layout Framework (TLF)
- TextArea
- TextArea (Spark)
- TextBox
- TextConverter
- TextEvent
- TextFlow
- TextFlowUtil
- TextFormat
- TextGraphic
- TextInput
- TextInput (Spark)
- TextLayoutFormat
- TextView
- Themes
- TileLayout
- TileList
- TileOrientation
- Timer
- TitleWindow
- TitleWindow (Spark)
- TLF
- ToggleButton (Spark)
- ToggleButtonBar
- ToolTip
- Transition
- Tree
- TruncationOptions
- UIComponent
- UIFTETextField
- Updater
- URLLoader
- URLRequest
- URLUtil
- URLVariables
- ValidationResultEvent
- Validator
- Validators
- VBox
- VDividedBox
- Vector
- VerticalLayout
- VerticalLayout (Spark)
- VGroup (Spark)
- Video
- VideoDisplay
- VideoElement
- VideoElement (Spark)
- VideoEvent
- VideoPlayer (Spark)
- VideoPlayerScrubBar
- ViewStack
- VScrollBar (Spark)
- VSlider
- VSlider (Spark)
- XML
- XMLList
- XMLListCollection
- ZipCodeValidator
- ZipCodeValidatorDomainType
- Zoom
-
Articles
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
-
Meta


Thanks for this post, it’s quite topical and removing the VRules was something I was struggling with.
Another aspect of the RichTextEditor I’m having difficulty editing is the ControlBar that the toolbar and controls are contained within. I can’t find a good way to target it and I want to remove the background from this component. Any thoughts on how I could tackle that?
What I wanted to accomplish is to make the background invisible either make it transparent or changing its color to match the background (white). I did the following:
I noticed that RTE needs to have the border defined to be able to modify the default background. So after setting the border you may be able to set the alpha to transparent.
while not quite what i was looking for this was lots of help in adding a button to the toolbar
.. and after a bit of experimenting (still learning flex and as3) i found i could add before the TextArea with…
Hi !
Any idea on how to remove the title bar from a richTextEditor ?
I know there are titleBar and titleTextField properties on richTextEditor but they are protected properties …
Thanx.
you’re going to have to subclass RichTextEditor in order to be able to access those protected components
Hi,
I know the post its quite old but I would like to ask if it is possible to remove the textarea from the rte and add it into a different place [into a canvas, for example]?
Another question: It is possible to create a new textarea and make it editable using the same rte over and over?
Thanks :)
Your blog RuLeZ!
Taniguchi Toshio, J.,
I’ve never tried fully customizing the RichTextEditor control, but you can find the MXML source code in your Flex SDK folder at <Flex SDK>\frameworks\projects\framework\src\mx\controls\RichTextEditor.mxml
It may be possible to copy/paste that file and reorder the MXML components at the bottom of the code (or remove the TextArea altogether and pass a reference to an existing TextArea control to your custom RichTextEditor component).
Hope that helps,
Peter
Somebody asked how you could create a RichTextEditor with only the
linkTextInput, and I came up with this. I’ll try and port this to a full example later if I get some time:Peter
Done; http://blog.flexexamples.com/2010/02/17/removing-controls-from-the-mx-richtexteditor-control-in-flex/