i have a number of cases where trying to update texts, usually on RichEditableText objects generated in actionscript, does not show up or shows up in a weird way.
RichEditableText component already declared in MXML. simplifying, when i use something like:
var myTextFlow:TextFlow = TextConverter.importToFlow(strToFormat, TextConverter.TEXT_FIELD_HTML_FORMAT);
questionText.textFlow = myTextFlow; // questionText is a RichEditableText declared in MXML
sometimes it shows well but most times it is a mixture of 1-2 lines from the new text + 1-2 lines from the text which was there earlier. this is not due to wrong assignment into vars but maybe i need to initialize or refresh the component? is there a refresh function??
i have 2 seperate bunches of RichEditableText components, created in actionscript with formatting and data for each (along with wrapping VGroups and HGroups).
the 2 are each associated to a different State and, as far as i know, should appear/disappear according to the current State.
however, if "bunch 1" appears and then i switch state to see "bunch 2" instead -- the window is empty - as if no text exists in the RichEditableTextobjects.
and also vice versa - if i first look at "bunch 2" it appears well, but when trying to switch State and see "bunch 1" instead -- the window again becomes empty of text (although it appeared well in the previous scenario going to "bunch 1" first).
am i missing a refresh of some sort???
Thanks for the answer, but unfortunately it didn't help.
I agree it has to be something like that - forcing a refresh/revalidate of some sort...
Forgot to mention eartlier:
When mouse-clicking on the RichEditableText area which shows a mixture of previous text + new text ==> the text is "refreshed" and all appears well.
Can you help?
I did not spend time to figure out a workaround. IIRC, the issue is that
the method remeasureText() in RichEditableText.as needs to return false, but
doesn't. There are various ways you might be able to get it to return
false. Maybe if you step through it you can figure out which one will be
easiest to hack.
I encountered exactly the same issue as the OP. Tried a lot of things like: Settting the text property to "", or setting textFlow to null, etc. To no avail. What did make a difference however was when I gave the RichtEditableText a fixed width. So in conclusion:
Percent width (eg. 100%) doesn't work, whereas a fixed width (eg. 300) works just fine.
I had this same issue. What i had to do was the following.
messageTextFlow = null; // this was my textflow needed to null out
richTxt.validateNow(); // this was the refresh the RichEditableText that uses the textFlow
messageTextFlow =TextConverter.importToFlow(__Data.Standard, TextConverter.TEXT_FIELD_HTML_FORMAT) //this set it to the new info
richTxt.validateNow(); // refresh to new
This fixed my issue hope it helps you. I did this on my set data function.
I also encountered this bug (and spent abount a day going crazy before finally finding this thread). I attempted both of the workarounds listed by GiantRobotKitten and stubbs311, and only GiantRobotKitchen's workaround of using a fixed width for the RichEditableText was successful. Thanks and good luck to all!