> The RichTextEditor is a Halo component, and RichText is a spark component so with similar names
The new Spark "text primitives" are SimpleText, RichText, and RichEditableText. This nomenclature may create some confusion with the old Halo RichTextEditor, but after lots of discussions we felt they were the best names to describe what they do, and we wanted the best names going forward. RichTextEditor, like other Halo components, will at some point become obsolete when the Spark component set is complete.
> it seems that RichText would have an easy html method like RichTextEditor
The richness that RichText and RichEditableText is that of TLF, the new Text Layout Framework. TLF has a markup language that is similar to XHTML, but in TLF the primary representation of rich text isn't markup. Instead, it's a tree of ActionScript objects such as DivElements, ParagraphElements, and SpanElements. The root of this tree is an object known as a TextFlow.
Therefore in the latest trunk builds of Gumbo, RichText and RichEditableText expose a 'textFlow' property which you set to a TextFlow. If you have markup as a String or as XML, there is now a utility class called TextFlowUtil for converting the markup to and from a TextFlow. A TextFlow is very powerful because you can access its parts as ActionScript objects and change them at runtime.
Halo components did not have an object-oriented model of rich text, so they just exposed the htmlText:String property, which is not as powerful when you want to change just part of a long document.
> is there an easy way of loading RichTextEditor html/rich text into a textarea
Doesn't myTextArea.htmlText = myRichTextEditor.htmlText do what you want?
Adobe Flex SDK Team
Thank you very much for the reply, it was extremely informative and helpful;
and thank you for your time.
Before I wrote my message in the forum I did try a sparks TextArea declared
in MXML and then in a script try to access the htmlText as you showed below
- this is flex's response:
Description Resource Path Location Type
1119: Access of possibly
undefined property htmlText through a reference with static type
spark.components:TextArea. line 177 Flex Problem
Also, in the language reference I did not see mention of htmltext property
I always say has to be user error.
Thanks again for your help and time,
Sorry, I thought you were trying to just take HTML out of a Halo RichTextEditor and put it into a Halo TextArea. It sounds like you want to put it into a Spark TextArea.
In current builds, I think you could do this by using TLF's TextConverter class. It supports various formats of markup strings, including HTML_FORMAT, and lets you create TextFlows from them. So you could try doing something like this:
mySparkTextArea.textFlow = TextConverter.importToFlow(myRichTextEditor.htmlText, TextConverter.HTML_FORMAT);
Adobe Flex SDK Team
Thanks again for the replay. To be a little clearer...
I am trying to use all sparks components if possible, as was suggested in
Adobe docs, plus it sounds like Halo is being phased out.
One part of this app is to have users write text and/or cut and paste from
another app, and Halo's RichTextEditor was the simplest interface to
implement and it fit this task perfectly with all the UIComponents and
RichText capability. Another part of the app was to have the users view the
original docs in one panel and in a side panel edit/update the originals,
plus have the ability to cut and paste from the original if need be. Again,
Halo RTE was the simplest for me to implement and it fit this task
perfectly, but I am trying to use Spark components if possible (less
re-writes down the road to keep up to date).
Thanks again for your time and help, much appreciated,
I'd be concerned that trying to "interop" between the two text models might cause problems... The way text renders in a Halo component like RichTextEditor, which is based on TextField, can be somewhat different from the way it renders in a Spark component like RichText, which is based on FTE and TLF. My suggestion would be to develop your own version of RichTextEditor, by taking the Spark TextArea component and adding a toolbar above it with formatting controls.
Adobe Flex SDK Team
Again, thank you for your time and insight.
I had planned on doing your suggestion below, as I've seen this recently
Please let me know when your FlashBuilder book comes out; I'll be first in
I appreciate and enjoy your thorough answers.