Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 如何从mx:LegendItem获取fillColor_Apache Flex_Actionscript 3_Flex3 - Fatal编程技术网

Apache flex 如何从mx:LegendItem获取fillColor

Apache flex 如何从mx:LegendItem获取fillColor,apache-flex,actionscript-3,flex3,Apache Flex,Actionscript 3,Flex3,我需要从legendItem中获取fillcolor,Hower在做什么 lItem.getStyle("fill") 返回与实际legendItem标记颜色不同的颜色。这里有没有关于我做错了什么的提示?这应该会返回给您填充的颜色。从lItem.getStyle(“fill”)返回的变量类型是SolidColor。需要注意的事项 如果使用fill函数或fills设置图表的填充颜色,则图例将与图表颜色不同步:( “如果使用fills属性或Fill函数定义图表项的填充,并且需要图例,则必须手动

我需要从legendItem中获取fillcolor,Hower在做什么

lItem.getStyle("fill") 

返回与实际legendItem标记颜色不同的颜色。这里有没有关于我做错了什么的提示?

这应该会返回给您填充的颜色。从
lItem.getStyle(“fill”)
返回的变量类型是SolidColor。

需要注意的事项

如果使用fill函数或fills设置图表的填充颜色,则图例将与图表颜色不同步:(


“如果使用fills属性或Fill函数定义图表项的填充,并且需要图例,则必须手动为该图表创建图例对象。”

您可以从图例项中获取图表系列颜色,如下所示:

var chartElement:ChartElement = legendItem.element as ChartElement;
var chartElementSolidColor:SolidColor = chartElement.getStyle("fill") as SolidColor;
var chartElementColor:uint = chartElementSolidColor.color;