Macromedia flex 2 Manual

Página de 254
184
Creating Custom Style Properties
About inheritance in Cascading Style Sheets
When you implement a style property in an ActionScript component, that property is 
automatically inherited by any subclasses of your class, just as methods and properties are 
inherited. This type of inheritance is called object-oriented inheritance. 
Some style properties also support Cascading Style Sheet (CSS ) inheritance. CSS inheritance 
means that if you set the value of a style property on a parent container, a child of that 
container inherits the value of the property when your application runs. For example, if you 
define the 
fontFamily
 style as Times for a 
Panel
 container, all children of that container use 
Times for 
fontFamily
, unless they override that property. 
In general, color and text styles support CSS inheritance, regardless of whether they are set by 
using CSS or style properties. All other styles do not support CSS inheritance, unless 
otherwise noted.
If you set a style on a parent that does not support CSS inheritance, such as 
textDecoration
only the parent container uses that value, and not its children. There is an exception to the 
rules of CSS inheritance. If you use the global type selector in a CSS style definition, Flex 
applies those style properties to all controls, regardless of whether the properties are 
inheritable.
For more information about style inheritance, see Chapter 18, “Using Styles and Themes,” in 
Flex 2 Developer’s Guide.
About setting styles
Flex provide several ways of setting component styles: using MXML tag attributes, calling the 
setStyle()
 method, and CSS. This section describes the different ways to set styles, and the 
actions that Flex performs when you set styles.