Uhmmm... What a curious feature side effect.

It is not the kind of effect yo would expect I ahev to say. Using the
Flex Builder somehow drives you to use states and remove add
components with them.

I tried this hack before and it works but it makes the code uglier :(
I dont like this behaviour...

Thanks in any case for the help.

Javier.

--- In [email protected], "Daniel Freiman" <[EMAIL PROTECTED]> wrote:
>
> This is a feature.  When a UIComponent is added flex executes the
styles to
> make sure it look correct.  The specific code is validateNow() in the
> UITextField.
> 
> You could fix this using subclassing but this is probably a pain and
more
> trouble than it's worth in your situation.
> 
> I think you want to create a variable in your app and then set the
> RTE.htmlText property to it before the RTE is removed, and then when
the RTE
> is added set the RTE.htmlText property to that variable.  I'm not an
expert
> on States, but my guess is it looks something like this:
> 
> <mx:states>
>    <mx:State name="state1" >
>       <mx:RemoveChild target="{button1}"/>
>       <mx:SetProperty target="{richTextEditorExample}" name="htmlText"
> value="{htmlCache}" />
>    </mx:State>
>    <mx:State name="state2">
>       <mx:SetProperty name="htmlCache" value="{
> richTextEditorExample.htmlText}" />
>       <mx:RemoveChild target="{richTextEditorExample}"/>
>       <mx:RemoveChild target="{button2}"/>
>    </mx:State>
> </mx:states>
> <mx:Script>
>    <![CDATA[
>       public var htmlCache:String = exampleModel.exampleText;
>    ]]>
> </mx:Script>
> 
> Dan Freiman
> nondocs <http://nondocs.blogspot.com>
> 
> On 5/25/07, Javier de la Torre <[EMAIL PROTECTED]> wrote:
> >
> >   You are right, if I set it to fontWeight bold then the
formatting starts
> > getting change to bold...
> > Is this a bug or a feature? Is there any way to avoid this behaviour?
> >
> > Thanks.
> >
> > Javier.
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>,
"Daniel
> > Freiman" <FreimanCQ@>
> > wrote:
> > >
> > > My guess is that when you add RTE as a child it is reseting the text
> > based
> > > on the styles. As a quick check, set the fontWeight of the RTE equal
> > to
> > > bold and see if the formating starts getting changed to bold instead
> > of the
> > > default font style.
> > >
> > > Daniel Freiman
> > > nondocs <http://nondocs.blogspot.com>
> >
> > >
> > > On 5/24/07, Javier de la Torre jatorre@ wrote:
> > > >
> > > > Hi all,
> > > >
> > > > I am facing a problem when using the RichTextEditor in an
> > application with
> > > > several states. I have a richTextEditor bound to a model in a
state
> > and when
> > > > I change to another state and get back all the changes in the
> > formatting
> > > > inside the richtexteditor are gone, it just suddenly changes the
> > formatting
> > > > back. It just change back the formatting, the text remains intact.
> > > > Maybe it is easier just to show a simple code:
> > > >
> > > > --------
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="absolute"
> > > > currentState="state1">
> > > > <mx:Model id="exampleModel"> <exampleModel>
> > > > <ExampleText>{richTextEditorExample.htmlText}</ExampleText>
> > > > </exampleModel>
> > > > </mx:Model>
> > > > <mx:states>
> > > > <mx:State name="state1" >
> > > > <mx:RemoveChild target="{button1}"/>
> > > > </mx:State>
> > > > <mx:State name="state2">
> > > > <mx:RemoveChild target="{richTextEditorExample}"/>
> > > > <mx:RemoveChild target="{button2}"/>
> > > > </mx:State>
> > > > </mx:states>
> > > >
> > > > <mx:RichTextEditor id="richTextEditorExample" htmlText="{
> > > > exampleModel.ExampleText}" x="10" y="38">
> > > > </mx:RichTextEditor>
> > > > <mx:Button x="10" y="10" label="Go to State 2"
click="{currentState=
> > > > 'state2'}" id="button2"/>
> > > > <mx:Button x="120" y="10" label="Go to State 1"
> > click="{currentState=
> > > > 'state1'}" id="button1"/>
> > > > </mx:Application>
> > > > --------
> > > > When you enter the app go and add some text on the RichTextEditor,
> > make a
> > > > word bold, go to state 2 and the get back to state 1. The text in
> > the editor
> > > > is fine but the bold is gone.
> > > >
> > > > I have place this little code on a server for you to try:
> > > >
> > http://www.imastedev.com/RichTextEditorExample/testRichTextEditor.html
> > > >
> > > > Any idea of what could be going wrong?
> > > >
> > > > Thanks in advance.
> > > >
> > > > Javier.
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >  
> >
>


Reply via email to