//New imports needed
import spark.primitives.BitmapImage;
import mx.graphics.ImageSnapshot;
//Add this new public function
public function exportImage():BitmapImage
{
var bmpLegend:BitmapData = ImageSnapshot.captureBitmapData(legendDataGroup);
var printImg:BitmapImage = new BitmapImage();
printImg.smooth = true;
printImg.source = bmpLegend;
return printImg;
}
//Also the LegendDatGroup needs an Id
<Legend:LegendDataGroup id="legendDataGroup" dataProvider="{legendAC}">