To be honest, I'm not sure why it's using the default Flex styles at the beginning. What I do know is that when I set up my component's default style in the manner I posted, it works. The answer to your question lies in the underbelly of the Flex architecture and how/when it applies styles; there are probably other people on here that are much more qualified to explain.
Good luck! Aaron On Thu, Dec 4, 2008 at 1:44 PM, pratikshah83 <[EMAIL PROTECTED]> wrote: > Hi Aaron, > > Thanks for you reply. I was just wondering that I am currently doing > the styling in initialize() method. So the charts is not rendered until > that time, so why is the default flex axis is getting rendered. > When the chart is rendered my styles should already be set. > > So how the updateDisplayList() method is getting called. I need to get > my styles set before the updateDisplayList() method is called. > > Do you have any idea if preinitialize() method help ?? > > Thanks > Pratik > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Aaron > Hardy" <[EMAIL PROTECTED]> > wrote: > > > > > I think I understand your question. Try throwing this in your > component > > (outside of any methods/properties) and tweaking for your needs: > > > > // Default styles > > ////////////////////////////// > > private static var classConstructed:Boolean = > classConstruct(); > > > > /** > > * @private > > * Creates default styles that can be overridden by the > developer. > > */ > > private static function classConstruct():Boolean { > > var styleDeclaration:CSSStyleDeclaration = > > StyleManager.getStyleDeclaration('Cursor'); > > > > if (!styleDeclaration) { > > styleDeclaration = new CSSStyleDeclaration(); > > } > > > > styleDeclaration.defaultFactory = function():void { > > this.color = 0xFF0000; > > } > > > > StyleManager.setStyleDeclaration('Cursor', > styleDeclaration, > > false); > > > > return true; > > } > > > > > > Note that "Cursor" is the component's name. This way of setting a > default > > style personally seems rather unorthodox but it's the only way I've > seen > > that works. I hope a better/developer-friendly approach is offered > in > > future versions of Flex. > > > > Aaron > > > > On Thu, Dec 4, 2008 at 12:27 PM, pratikshah83 > <[EMAIL PROTECTED]>wrote: > > > > > Hi Guys, > > > > > > I had a question regarding the component life cycle. I am > extending > > > flex charts and adding my custom style to it. > > > > > > But when I load the chart I see the default flex axis being shown > and > > > than it would disappear and my styled axis shows up. I am > wondering > > > where do I style my axis such that default flex components are not > > > rendered. > > > > > > Currently I am doing my custom styling in initialize() method. > Please > > > let me know which component life cycle method show I be doing the > > > styling. > > > > > > Your replies would be appreciated. > > > > > > Thanks > > > Pratik > > > > > > > > > > > > > >