(Preview)
Package | mx.styles |
Class | public class CSSStyleDeclaration |
Inheritance | CSSStyleDeclaration ![]() ![]() |
Subclasses | AdvancedDataGridColumn, DataGridColumn |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A CSS rule such as
Button { color: #FF0000 }affects every instance of the Button class; a selector like
Button
is called a type selector
and must not start with a dot.
A CSS rule such as
.redButton { color: #FF0000 }affects only components whose
styleName
property
is set to "redButton"
;
a selector like .redButton
is called a class selector
and must start with a dot.
You can access the autogenerated CSSStyleDeclaration objects
using the StyleManager.getStyleDeclaration()
method,
passing it either a type selector
var buttonDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration("Button");or a class selector
var redButtonStyleDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".redButton");
You can use the getStyle()
, setStyle()
,
and clearStyle()
methods to get, set, and clear
style properties on a CSSStyleDeclaration.
You can also create and install a CSSStyleDeclaration at run time
using the StyleManager.setStyleDeclaration()
method:
var newStyleDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration(".bigMargins"); newStyleDeclaration.defaultFactory = function():void { leftMargin = 50; rightMargin = 50; } StyleManager.setStyleDeclaration(".bigMargins", newStyleDeclaration, true);
More examples
Related API Elements
Public Properties
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
selectorIndex : int = 0
The order this CSSStyleDeclaration was added to its StyleManager. | CSSStyleDeclaration |
Public Methods
Method | Defined By | ||
---|---|---|---|
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Property Detail
selectorIndex | property |
public var selectorIndex:int = 0
The order this CSSStyleDeclaration was added to its StyleManager. MatchStyleDeclarations has to return the declarations in the order they were declared
Constructor Detail
Method Detail
Wed Nov 21 2018, 06:34 AM -08:00