title: Using Per Item Fills in Flex/Actionscript
body: <p>I am creating a chart using mxml. The mxml tags only create a chart with a horizontal axis and vertical axis.</p>
  
  <p>My result event handler has actionscript code that loops through the xml result set and creates all the series (line series and stacked bar). This part of the code works fine.</p>
  
  <p>Now I need to use the functionfill function to set individual colors to each series. All the examples I have found call the functionfill from within an MXML tag, like so:</p>
  
  <pre><code>       &lt;mx:ColumnSeries id="salesGoalSeries" 
              xField="Name" 
              yField="SalesGoal" 
              fillFunction="myFillFunction" 
              displayName="Sales Goal"&gt;
  </code></pre>
  
  <p>I am having trouble calling functionfill from actionscript.</p>
  
  <p>A portion of the code that build the data series is below:</p>
  
  <pre><code>if (node.attribute("ConfidenceStatus")=="Backlog" 
  || node.attribute("ConfidenceStatus")=="Billings") {
  // Create the new column series and set its properties.
  var localSeries:ColumnSeries = new ColumnSeries();
  localSeries.dataProvider = dataArray;
  localSeries.yField = node.attribute("ConfidenceStatus");
  localSeries.xField = "TimebyDay";
  localSeries.displayName = node.attribute("ConfidenceStatus");
  localSeries.setStyle("showDataEffect", ChangeEffect);
  localSeries.fillFunction(setSeriesColor(xxx));
  
  // Back up the current series on the chart.
  var currentSeries:Array = chart.series;
  
  // Add the new series to the current Array of series.
  currentSeries.push(localSeries);
  
  //Add Array of series to columnset
  colSet.series.push(localSeries);  
  
  //assign columnset to chart
  chart.series = [colSet];
  </code></pre>
  
  <p>My setSeriesColor function is:</p>
  
  <pre><code>private function setSeriesColor(element:ChartItem, index:Number):IFill {
  var c:SolidColor = new SolidColor(0x00CC00);
  var item:ColumnSeriesItem = ColumnSeriesItem(element);
  
  //will put in logic here
  return c;
  
  }
  </code></pre>
  
  <p>What parameters do I put in the line localSeries.fillFunction(setSeriesColor(xxx)) ?</p>
  
  <p>I tried localSeries as the first argument but I get an implicit coercion error telling me localSeries can't be cast as ChartItem.</p>
  
  <p>How do I call the function correctly?</p>