Hmmmmm I don't use charts. Maybe you could try...
myComp.myChart.styleName = "noGutterChart"; Actaully, the myChart component may not have been instantiated at that point. I would add a creationComplete event handler to the myChart component that dispatches a custom event that will bubble up to the component that you are in. When that event comes in, apply the style. --- 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. > > > > > > > > > On Fri, Jan 15, 2010 at 9:49 AM, valdhor <valdhorli...@...>wrote: > > > > > > > In that case he should use the styleName property... > > > > .myStyle > > { > > cornerRadius: 9; > > fillAlphas: 1, 1, 1, 1; > > fillColors: #6699ff, #6699ff, #6699ff, #6699ff; > > themeColor: #00ff00; > > fontSize: 24; > > } > > > > > > var button:Button = new Button; > > button.label = "My Fancy New Button"; > > button.styleName = "myStyle"; > > this.addChild(button); > > > > > > --- In [email protected], Erik de Bruin <erikdebruin@> wrote: > > > > > > Hi, > > > > > > I think he's trying to set a named CSS style ("myStyle") on the Button > > using > > > setStyle(). I don't think that's possible? > > > > > > EdB > > > > > > On Fri, Jan 15, 2010 at 3:02 PM, valdhor valdhorli...@...: > > > > > > > > > > > > > > > > > I don't understand. Once you use the "new" operator, the button is > > > > instantiated. You can apply all sorts of styles to it before adding it > > to > > > > the displayList. For example, this works for me... > > > > > > > > var button:Button = new Button; > > > > button.label = "My Fancy New Button"; > > > > button.setStyle("cornerRadius", 9); > > > > button.setStyle("fontSize", 24); > > > > button.setStyle("themeColor", '#00FF00'); > > > > button.setStyle("fillColors", ['#6699ff', '#6699ff', > > > > '#6699ff', '#6699ff']); > > > > button.setStyle("fillAlphas", [1, 1, 1, 1]); > > > > this.addChild(button); > > > > > > > > > > > > > > > > --- In [email protected], "hworke" kanpsack@ wrote: > > > > > > > > > > > > > > > > > > > > Hi I am trying to apply style in a newly created component > > > > > but since it is not instantiated it gives me error message. > > > > > > > > > > My code is like this: > > > > > > > > > > var button:Button = new Button; > > > > > button.setStyle("styleName", "myStyle"); > > > > > canvas.addChild(button); > > > > > I need to create the component dynamically and also need > > > > > to apply the style dynamically. How can I do that? > > > > > > > > > > Regards, > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Ix Multimedia Software > > > > > > Jan Luykenstraat 27 > > > 3521 VB Utrecht > > > > > > T. 06-51952295 > > > I. www.ixsoftware.nl > > > > > > > >

