简体   繁体   中英

flex - how to set the background color of a spark check box text label?

I have a simple spark mxml check box and I want to change the background color via actionscript. I have searched and tried many suggestions, including using setStyle with 'background-color', 'chromeColor', symbolColor and others like this - the only thing that worked at all is chromeColor, which colored the box but not the text or background:

insUpdatedCB.setStyle('chromeColor','yellow');

I also tried using text format like this:

var myTf:TextFormat = new TextFormat();
myTf.size = 16; 
myTf.color = 0xFF0000; 
insUpdatedCB.setStyle("textFormat", myTf);  

also did not work

how can I set the label/text background color?

If you want to change the background color of the spark checkbox, then you have to apply a custom skin for it. Make a new Custom skin by making a copy of default checkboxSkin for spark checkbox, and then change the background color of the label in the Custom Skin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM