Thanks matt! :)

On Fri, 11 Mar 2005 13:39:47 -0500, Matt Horn <[EMAIL PROTECTED]> wrote:
> 
> Sorry for the reply to my own message, but I tried out some stuff; here's a
> quick and dirty way to prevent style inheritance with a custom component
> (called SpecialPanel in this example). 
> 
> The regular panel picks up the styles from the CSS class selector in the
> main application file (these are the default colors). The special panel (in
> this case, the outer panel) picks up its header colors from the inline style
> declaration on the custom MXML component. This style is not inherited by the
> inner panels. 
> 
> ----------------MainApp.mxml----------------- 
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
> xmlns:local="*" > 
> <mx:Style>
> Panel {
> headerColors:#E1E5EB, #F4F5F7; 
> }
> </mx:Style>
> <local:SpecialPanel>
> <mx:Button id="b1" label="Click Me"/>
> <mx:Panel>
> <mx:Button id="b2" label="Click Me Too"/> 
> </mx:Panel>
> </local:SpecialPanel> 
> </mx:Application>
> 
> ------------SpecialPanel.mxml--------------- 
> <?xml version="1.0"?>
> <mx:Panel xmlns:mx="http://www.macromedia.com/2003/mxml";
> headerColors="[0xCC66CC,0x3366CC]"> 
> </mx:Panel>
> 
> 
> HTH, 
> 
> matt horn 
> 
> 
> 
> 
> ________________________________
> From: Matt Horn [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 11, 2005 1:27 PM
> To: [email protected]
> Subject: RE: [flexcoders] mx:Panel and disabling CSS Inheritance.
> 
> 
> 
> I don't know of any way to prevent an inheriting style from being inherited
> except to write a custom component. However, you can use CSS to your
> advantage by having a default style and your custom style. Apply the custom
> style to the outer panel and then the default style to the inner panels
> (which will then propagate to the inner panels' children). 
> 
> THe following example illustrates this: 
> 
> <?xml version="1.0"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
> 
> <mx:Style>
> outerStyle {
> headerColors:#CC66CC,#3366CC;
> }
> innerStyle {
> headerColors:#E1E5EB, #F4F5F7;
> }
> </mx:Style>
> 
> <mx:Script><![CDATA[ 
> 
> ]]></mx:Script>
> 
> <mx:Panel className="outerStyle">
> <mx:Button id="b1" label="Button 1" /> 
> <mx:Panel className="innerStyle">
> <mx:Button id="b2" label="Button 2" /> 
> <mx:Panel>
> <mx:Button id="b3" label="Button 3" /> 
> </mx:Panel>
> </mx:Panel>
> </mx:Panel>
> </mx:Application> 
> 
> HTH, 
> 
> matt horn
> 
> 
> ________________________________
> From: Scott Barnes [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 11, 2005 12:19 AM
> To: [email protected]
> Subject: [flexcoders] mx:Panel and disabling CSS Inheritance.
> 
> 
> Hi All,
> 
> I have an mx:Panel, with a simple headerColors=[col1,col2] approach,
> easy enough.
> 
> BUT...
> 
> How do i prevent its children Panels/Controls from also inheriting
> that style? At the moment the only way i can think of is to do a long
> winded custom ActionScript which manipulates the instance of the
> mx:Panel itself - but there has to be a better way no?
> 
> --
> Regards,
> Scott Barnes
> http://www.mossyblog.com
> http://www.flexcoder.com
> 
> 
> 
> 
> Yahoo! Groups Sponsor 
> 
> ADVERTISEMENT
> 
> 
> ________________________________
> Yahoo! Groups Links
> 
> 
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
> 
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


-- 
Regards,
Scott Barnes
http://www.mossyblog.com


Reply via email to