Vaguely. TextArea keeps all the values of the TextField cached. So when
you edit the TextField directly, you're probably not affecting the
TextArea. I don't immediately see a way around this. All the methods you
would need access to in order to refresh the TextArea properties seem
private. You might want to try
http://livedocs.adobe.com/flex/3/langref/mx/controls/textClasses/TextRange.html(which
I've never used so I can't give you any more help than the
suggestion).
- Daniel Freiman
On Tue, Oct 21, 2008 at 12:41 AM, xmrcivicboix <[EMAIL PROTECTED]>wrote:
> 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] <flexcoders%40yahoogroups.com>,
> "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] <flexcoders%40yahoogroups.com>,
> "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
> > > >
> > > >
> > > >
> > >
> >
>
>
>