An update on this. I missed the style for the disabled colour, so the code
modification should be:

       /*
       Modified by {your name} (05/31/2007):

       The iconColor variable now gets its value from getStyle if it can,
otherwise it defaults to what was hardcoded in the CheckBoxIcon.as file.
       */
       var defaultIconColor:uint = 0x2B333C;
       var defaultIconDisabledColor:uint = 0x999999;

       var iconColor:uint = defaultIconColor;
       if (getStyle('iconColor') != undefined) iconColor =
getStyle('iconColor');

       var iconDisabledColor:uint = defaultIconDisabledColor;
       if (getStyle('iconDisabledColor') != undefined) iconDisabledColor =
getStyle('iconDisabledColor');
       /*
       End modification.
       */

And down further in the code in the case "selectedDisabledIcon" section
(line 375 in the original CheckBoxIcon.as file), change:
checkColor = 0x999999;

to:
iconColor = iconDisabledColor;

Also, make sure to change checkColor to iconColor (line 402 in the original
CheckBoxIcon.as file).


Alex Harui,

Will the disabled version be iconDisabledColor or disabledIconColor?
Personally, I prefer when styles are grouped in context, as in iconColor,
iconDisabledColor, iconOver, iconDisabled. Makes it easier to find styles in
the context of what you are modifying, instead of looking for states that
are related to the context, as in disabledIconColor, overIcon, disabledIcon,
etc. Two different ways to look at it, I guess.


On 5/30/07, Derek Vadneau <[EMAIL PROTECTED]> wrote:

Great, thanks! I'll modify my project to use iconColor so I won't forget
to change it when the new release happens.


On 5/30/07, Alex Harui < [EMAIL PROTECTED]> wrote:
>
>    It will be called iconColor in the next release
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto: [EMAIL PROTECTED]
> *On Behalf Of *ben.clinkinbeard
> *Sent:* Wednesday, May 30, 2007 3:40 PM
> *To:* [email protected]
> *Subject:* [flexcoders] Re: CheckBox check icon style - checkColor
> hardcoded?
>
>
>
> My guess is that its an oversight. They probably intended to go back
> and implement it as a style and forgot about it. There was an almost
> identical situation with borderColor in DataGrid, but they fixed it, I
> think in the 2.0.1 update.
>
> Definitely submit it to the bug/wish form.
>
> Ben
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "Derek
> Vadneau" <[EMAIL PROTECTED]> wrote:
> >
> > I ran into this and thought I'd share the solution I used.
> >
> > The problem:
> > How to change the colour of the check icon in the CheckBox component?
> >
> > Solution:
> > There are a few ways to do this but here is the one I opted for since
> > it allows me to change the colour through styles.
> >
> > 1. In the Style section of your MXML file:
> > <mx:Style>
> > CheckBox {
> > /* Overwriting the icon skin class */
> > disabledIcon:
> ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > downIcon: ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > overIcon: ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > selectedDownIcon:
> ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > selectedDisabledIcon:
> > ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > selectedOverIcon:
> ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > selectedUpIcon:
> ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > upIcon: ClassReference("mx.skins.halo.CheckBoxIconWithCheckColor");
> > /* Our new style */
> > checkColor: #FF0000;
> > }
> > </mx:Style>
> >
> > 2. Copy the file CheckBoxIcon.as from the Flex SDK
> > 2\frameworks\source\mx\skins\halo folder into the {your project
> > folder}\mx\skins\halo.
> >
> > 3. Rename the file to CheckBoxIconWithCheckColor.as.
> >
> > 4. Comment out line 24 (the Version.as include).
> >
> > 5. Replace line 137 and 138:
> >
> > // Placeholder styles stub
> > var checkColor:uint = 0x2B333C;// added style prop
> >
> > with:
> >
> > /*
> > Modified by {your name} (05/30/2007):
> >
> > The checkColor variable now gets its value from getStyle if it can,
> > otherwise it defaults to what was hardcoded in the CheckBoxIcon.as
> > file.
> > */
> > var defaultCheckColor:uint = 0x2B333C;
> > var checkColor:uint = defaultCheckColor;
> > if (getStyle('checkColor') != undefined) checkColor =
> getStyle('checkColor');
> > /*
> > End modification.
> > */
> >
> > That's it. Now when you specify a value for the checkColor style. In
> > the style code I posted I made it red so the difference would be
> > obvious.
> >
> >
> > Gripe/Rant:
> > There is a value for the colour in the CheckBoxIcon.as file, found in
> > the mx.skins.halo folder. The value was hardcoded, for whatever crazy
> > reason. Above and below that line of code are calls to getStyle, and
> > the checkColor declaration has comments referring to it as a style.
> >
> > Why, oh why, would this be hardcoded? I can change pretty much
> > anything else in almost any component using styles (frickin'
> > beautiful, btw), except the check icon color.
> >
> > --
> >
> > Derek Vadneau
> >
>
> >



--

Derek Vadneau




--

Derek Vadneau

Reply via email to