protected function preinitializeHandler ():void
{
var styleObjects:Array =new Array();//FlexGlobals.topLevelApplication.styleManager.selectors;
styleObjects.push( "mx.charts.chartClasses.ChartBase" );
styleObjects.push( "mx.charts.chartClasses.CartesianChart" );
styleObjects.push( "mx.charts.chartClasses.PolarChart" );
styleObjects.push( "mx.charts.BarChart");
styleObjects.push( "mx.charts.ColumnChart" );
styleObjects.push( "mx.charts.LineChart");
styleObjects.push( "mx.charts.PieChart");
styleObjects.push( "mx.charts.AxisRenderer" );
styleObjects.push( ".blockCategoryAxis");
styleObjects.push( ".blockNumericAxis");
styleObjects.push( ".linedNumericAxis");
styleObjects.push( ".dashedNumericAxis");
styleObjects.push( ".dashedCategoryAxis");
styleObjects.push( ".hangingCategoryAxis");
styleObjects.push( "mx.charts.GridLines");
styleObjects.push( ".horizontalGridLines");
styleObjects.push( "mx.charts.series.BarSeries" );
styleObjects.push( "mx.charts.series.ColumnSeries" );
styleObjects.push( "mx.charts.series.LineSeries" );
styleObjects.push( "mx.charts.series.PieSeries" );
for each(var styleObj:String in styleObjects) {
copyStyleFromParent(styleObj);
}
}
2.在该自定义widget头部中添加preinitialize="preinitializeHandler ()" 。
方法二:
在自定义widget中覆盖父类的moduleFactory方法:
override
public function get moduleFactory():IFlexModuleFactory {
return
FlexGlobals.topLevelApplication.moduleFactory;
}