Parent is of type DisplayObjectContainer which does not have getStyle.

 

So you have to cast:

 

            (parent as IStyleClient).getStyle("backgroundColor");

Or

            IStyleClient(parent).getStyle("backgroundColor");

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Geoffrey
Sent: Tuesday, May 15, 2007 10:10 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Getting Parent's Style

 

I'm converting some Flex1.5 code to flex 2.0.  One of the classes (a
commonly used custom component) uses the following to set the background
color to that of the parent container:

        
__labelCanvas.setStyle("backgroundColor")=_parent.getStyle("backgroundCo
lor");


This doesn't work in Flex2.0, nor does
parent.getStyle("backgroundColor");

How can I get a style attribute of a parent container?

BTW, I can't just let it be transparent because I need to obscure some
drawn graphic elements of the parent, but I want __labelCanvas to have
the same background color as the parent.  Also, the parent might not
always be the same color, else I would set a CSS descriptor for ! it.

Thanks,
GT 

 

Reply via email to