开发者

Setting fill style of flex legend item not working

开发者 https://www.devze.com 2023-03-29 04:58 出处:网络
I have been trying (but to no avail) to set the background color of a legend item in Flex to a color of my choosing.

I have been trying (but to no avail) to set the background color of a legend item in Flex to a color of my choosing.

Unfortunately, it doesn't seem to be working.

I obtain a reference to the legendItem in question and then set the fill style like so:

var legendItem开发者_开发技巧:LegendItem = event.item;
var legendItemColor:SolidColor = new SolidColor(0x00FF00, 0.5);
legendItem.setStyle("fill", legendItemColor);

I am able to set other styles of the legend item but, for some reason, this isn't working.

Any help would be greatly appreciated.

Thanks in advance.


Check out this example http://blogs.adobe.com/flexdoc/2008/07/customized_legend_layout.html


Managed to get the effect I was looking for by setting the opaqueBackground property of the legendItem.

legendItem.opaqueBackground = 0x00FF00;

Doesn't really make sense and I had even found an example where setStyle of fill was used and seemed to work for them.

Oh well, as long as it works!

0

精彩评论

暂无评论...
验证码 换一张
取 消