I need a Rich Text Editor so I'm making one but need help.
Hi all,
I'm still figuring out the TLF and how it works so my question might seem dumb to some but any help would be great.
I'm making a RTE because I need access to a TextFlow when the user is done editing the text. It wasn't obviouse that the halo RTE could do that so I'm making my own.
The problem I'm running in to is that a user can select a range of text and apply something like italics to it. But if they don't have a range selected, say for example they just want to start off typing in italics, then how would I do that?
I've tried doing this and it works for a range but not anything else
var textfmt:TextLayoutFormat = rte.getFormatOfRange(null, rte.selectionAnchorPosition, rte.selectionActivePosition);
textfmt.fontStyle = (textfmt.fontStyle == FontPosture.ITALIC) ? FontPosture.NORMAL : FontPosture.ITALIC;
rte.setFormatOfRange(textfmt, rte.selectionAnchorPosition, rte.selectionActivePosition);
I also tried this when there wasn't a range selected and it also didn't work
var f:TextLayoutFormat = new TextLayoutFormat();
f.fontStyle = FontPosture.ITALIC;
IEditManager(rte.textFlow.interactionManager).applyContainerFormat(f);
Any help would be great.
Thanks.
