[flexcoders] Re: apply style in newly created component

2010-01-15 Thread valdhor
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;

Re: [flexcoders] Re: apply style in newly created component

2010-01-15 Thread Erik de Bruin
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...@embarqmail.comwrote: I don't understand. Once you use the new operator, the button is instantiated. You can

[flexcoders] Re: apply style in newly created component

2010-01-15 Thread valdhor
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; }

Re: [flexcoders] Re: apply style in newly created component

2010-01-15 Thread Vivian Richard
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

[flexcoders] Re: apply style in newly created component

2010-01-15 Thread invertedspear
use the styleName option if your applying a CSS to it: mychart.styleName = noGutterChart; --- In flexcoders@yahoogroups.com, 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

[flexcoders] Re: apply style in newly created component

2010-01-15 Thread valdhor
Hm 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

Re: [flexcoders] Re: apply style in newly created component

2010-01-15 Thread Vivian Richard
I just tried as suggested and still the same. May be it does not get instantiated until it is added in its parent. May be!!! On Fri, Jan 15, 2010 at 10:50 AM, valdhor valdhorli...@embarqmail.comwrote: Hm I don't use charts. Maybe you could try...

[flexcoders] Re: apply style in newly created component

2010-01-15 Thread valdhor
Try this... ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:local=* creationComplete=onCreationComplete() mx:Style .noGutterChart { gutterLeft:0; gutterBottom:0; gutterTop:0;

[flexcoders] Re: apply style in newly created component

2010-01-15 Thread Amy
--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: Hm 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

Re: [flexcoders] Re: apply style in newly created component

2010-01-15 Thread Vivian Richard
Worked liked charm!!! I guess valdhor also suggested something like this in one of his initial mails. Thanks to all On Fri, Jan 15, 2010 at 12:45 PM, Amy amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, valdhor valdhorli...@...