Daniel,
Any idea why this would happen? I enter the text below, placed my cursor.
"Text I Entered [PLACED MY CURSOR HERE]";
Then I used textArea.getTextField().replaceSelectedText("SOME TEXT");
trace(textArea.htmlText) or trace(textArea.text). Got back where I
entered and not the text "SOME TEXT" even though I can visually see it
in the textarea.
--- In [email protected], "xmrcivicboix" <[EMAIL PROTECTED]>
wrote:
>
> OMG. This is nuts. I guess I should have read the docs a little
> better. =) hey thanks again!
>
> --- In [email protected], "Daniel Freiman" <FreimanCQ@> wrote:
> >
> > try:
> >
> >
>
http://livedocs.adobe.com/flex/3/langref/flash/text/TextField.html#replaceSelectedText()
> >
> > - Daniel Freiman
> >
> > On Mon, Oct 20, 2008 at 2:28 PM, xmrcivicboix <xmrcivicboix@>wrote:
> >
> > > I have this issue about the rich text editor that I hope
someone can
> > > help with. Basically, I want to be able to insert the string
> > > '<!--pagebreak-->' at a certain caret index. This works fine when I
> > > use the textarea.text property but when I use textarea.htmlText, it
> > > inserts the '<!--pagebreak--> 7 characters before the caret. This is
> > > because it counted the format '<B></B>' as indices. To
> > > illustrate what I meant. Take a look:
> > >
> > > TEXT INSERTING:
> > > The <B>United States</B> is acting in step with Europe, where
> > > governments often take a more interventionist stance in
economies and
> > > the financial systems are in the hands of a comparatively small
number
> > > of banks.
> > > [CURSOR GOES HERE]
> > > Britain took the lead last week, declaring its intention to take
> > > equity stakes in banks to steady them. In the last two days, France,
> > > Italy and Spain have announced rescue packages for their banks that
> > > include state shareholdings.
> > >
> > > RESULT:
> > > The <B>United States</B> is acting in step with Europe, where
> > > governments often take a more interventionist stance in
economies and
> > > the financial systems are in the hands of a comparatively small
number
> > > of <!--pagebreak-->banks.
> > >
> > > Britain took the lead last week, declaring its intention to take
> > > equity stakes in banks to steady them. In the last two days, France,
> > > Italy and Spain have announced rescue packages for their banks that
> > > include state shareholdings.
> > >
> > > CODE:
> > > var carIndex:int = textArea.getTextField().caretIndex;
> > > var beginText:String = this.htmlText.substring(0, carIndex);
> > > var endText:String =
> this.htmlText.substr(carIndex,this.htmlText.length);
> > > var text:String = beginText + "\n <!--pagebreak--> \n" +
> endText;
> > > this.htmlText = text;
> > >
> > > I can use the 'text' property but then I will lose all my
formatting.
> > >
> > > Can anyone think of a solution?
> > >
> > > Thanks
> > >
> > >
> > >
> >
>