[flexcoders] Component Life Cycle

2008-12-04 Thread pratikshah83
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 





Re: [flexcoders] Component Life Cycle

2008-12-04 Thread Aaron Hardy
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 = 0xFF;
}

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

  



Re: [flexcoders] component life cycle question

2008-05-03 Thread Luke Vanderfluit
Hi.

Im replying to my own post coz Ive worked out something...
I should pass the dataProvider fo the datagrid in my component from the 
main application (or some controller class).
I guess this is the recommended way:
That is. Supply any data for childcomponents from a main component.

Any suggestions or thoughts on this are welcome...

Kr.
Luke.


Luke Vanderfluit wrote:
 Hi.

 Ive been reading up on the component life cycle.

 However the following problem I still cant solve.

 I have an main application component that gets passed a request 
 parameter (personid) at runtime.
 (Application.application.parameters.personid)

 I then have a component called 'sitelist' that builds a datagrid based 
 on a server request involving the personid, so the server request relies 
 on the personid being passed on.

 In my main app I am able to see the personid parameter on loading, but 
 in the sitelist component personid is null on loading.
 It seems that the child component renders before the main app and 
 therefore the parameter doesnt exist at the time that the child is created.

 What is the recommended way of getting a runtime parameter in a 
 subcomponent?
 I appreciate any help.

 Kr.
 Luke.

 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links



   



[flexcoders] component life cycle question

2008-05-02 Thread Luke Vanderfluit
Hi.

Ive been reading up on the component life cycle.

However the following problem I still cant solve.

I have an main application component that gets passed a request 
parameter (personid) at runtime.
(Application.application.parameters.personid)

I then have a component called 'sitelist' that builds a datagrid based 
on a server request involving the personid, so the server request relies 
on the personid being passed on.

In my main app I am able to see the personid parameter on loading, but 
in the sitelist component personid is null on loading.
It seems that the child component renders before the main app and 
therefore the parameter doesnt exist at the time that the child is created.

What is the recommended way of getting a runtime parameter in a 
subcomponent?
I appreciate any help.

Kr.
Luke.