use the styleName option if your applying a CSS to it: mychart.styleName = "noGutterChart";
--- In [email protected], Vivian Richard <kanps...@...> wrote: > > Actually I am trying to apply a very simple style to a chart. My chart is > inside a > canvas component and in a separate file. I want to add this chart containing > canvas in dynamically. This component is like this: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Canvas width .....> > <mx:ColumnChart .... id ="myChart"> > </mx:ColumnChart> > </mx:Canvas> > > Now I have this simple styles for the the chart which are: > > .noGutterChart { > gutterLeft:0; > gutterBottom:0; > gutterTop:0; > gutterRight:0; > } > > Now as I am trying to create the component dunamically and want to apply > the > style to the chart I get the error message. > > var myComp:ChartComp = new ChartComp; > myComp.myChart.setStyle("styleName","noGutterChart"); > > This gives me the error message that I cannot access a function of a > null object.

