This is how to set fills programatically:

fills:Array = [];
var fill:RadialGradient = new RadialGradient();
var entries:Array = [];
entries.push( new GradientEntry(color, ratio, alpha))
entries.push( new GradientEntry(color2, ratio2, alpha2))
//additional entries as needed
fill.entries = entries;
fills.push(fill);
//additional fills as needed

series.setStyle("fills", fills);

another option would be to use a binding for the entry colors and just
change the value of the bound var

[Bindable] private var pie1Color:uint = 0xa1aecf;
[Bindable] private var pie11Color:uint = 0x47447a;

<mx:GradientEntry id="pie1" color="{pie1Color}" ratio="0"/>
<mx:GradientEntry id="pie11" color="{pie11Color}" ratio="1"/>

pie1Color = 0xFF0000;

--- In [email protected], "sonnygett" <[EMAIL PROTECTED]> wrote:
>
> hi guys, i have a problem about changing the pie chart color at runtime.
> for example, i have this chart :
> 
> <mx:PieChart id="pcRegion" width="100%" height="100%" >
> <mx:series>
> <mx:Array>
> <mx:PieSeries field="revenue" nameField="name" labelPosition="callout"
> labelFunction="getSliceLabel" showDataEffect="{interpolate}">
> <mx:fills>
> <mx:Array>
> <mx:RadialGradient>
> <mx:entries>
> <mx:Array> 
> <mx:GradientEntry id="pie1" color="#A1AECF" ratio="0"/>
> <mx:GradientEntry id="pie11" color="#47447A" ratio="1"/>
> </mx:Array>
> </mx:entries>
> </mx:RadialGradient>
> </mx:series>
> </mx:PieChart>
> 
> and need to change the gradient entry with the id pie1 anda pie11,i
> did it like this:
> pie1.color=0xFF0000;
> but its seems doesn't work.
> can someone help me?
> thanks,
> regards
>


Reply via email to