I investigated this a bit and I found an answer to your question: the
themeColor is actually being set, but it's only visible when the focus on
the control is redrawn, i.e. when the control looses and regains focus
again. A solution would be to force the control to redraw the focus when you
change the theme color and here is a code that does this (I don't know if
this is the best solution though):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">

    <mx:Script>
        <![CDATA[
            private function updateFocusColor():void
            {
                if (ti.text.length < 3)
                    ti.setStyle('themeColor', 0xFF0000);
                else
                    ti.setStyle('themeColor', 0xEAEAEA);
                ti.focusManager.getFocus().drawFocus(true);
            }
        ]]>
    </mx:Script>

    <mx:TextInput id="ti" change="updateFocusColor()"
focusIn="updateFocusColor()" />
</mx:Application>

In this example, the text must have more than 3 characters to be valid. I
also do the validation in the focusIn event to make sure when the TextInput
gets the focus the first time, the focus color is set according to the
validation rule.

Haykel Ben Jemia

Allmas
Web & RIA Development
http://www.allmas-tn.com




On Fri, Nov 28, 2008 at 5:50 PM, what3v3r82 <[EMAIL PROTECTED]>wrote:

>   errorColor only works when errorString is defined, and if the
> errorString is defined I get a tooltip that I don't want.
>
> The Glow could be a solution ... I don't know why I have to do a
> workaround. Why doesn't the textinput.setStyle("themeColor",
> "0xFF0000") work?
>
> thanks
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "Fotis
> Chatzinikos"
>
> <[EMAIL PROTECTED]> wrote:
> >
> > A possibly better solution via a glow filter:
> >
> > <mx:TextInput text="test">
> > <mx:filters>
> > <mx:GlowFilter blurX='6' blurY='6'
> > alpha='1' color='#ff0000'
> > knockout='false' quality='1'
> > strength='25' inner='false'/>
> > </mx:filters>
> > </mx:TextInput>
> >
> >
> > On Fri, Nov 28, 2008 at 12:44 AM, Fotis Chatzinikos <
> > [EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> > >
> > > did you try errorColor? Have not used it but its there...
> > >
> > > As for the tooltip you can try errorString " " (a space character)
> > >
> > >
> > > On Thu, Nov 27, 2008 at 3:44 PM, what3v3r82 <[EMAIL PROTECTED]>wrote:
> > >
> > >> yes, but the tricky part is that I don't want to have the tooltips
> > >> appear. I have my own custom tooltips that work in a different way.
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > Fotis Chatzinikos, Ph.D.
> > > Founder,
> > > Phinnovation
> > > [EMAIL PROTECTED],
> > >
> >
> >
> >
> > --
> > Fotis Chatzinikos, Ph.D.
> > Founder,
> > Phinnovation
> > [EMAIL PROTECTED],
> >
>
>  
>

Reply via email to