Packagefeathers.core
Classpublic class FeathersControl
InheritanceFeathersControl Inheritance starling.display.Sprite
Implements IFeathersControl, ILayoutDisplayObject
Subclasses BaseScreenNavigator, BaseTextEditor, BaseTextRenderer, BasicButton, ButtonGroup, Callout, DateTimeSpinner, DefaultGroupedListHeaderOrFooterRenderer, Drawers, Header, ImageLoader, Label, LayoutGroup, NumericStepper, PageIndicator, PickerList, ProgressBar, ScrollBar, Scroller, SimpleScrollBar, Slider, SoundChannelPeakVisualizer, SpectrumBarGraphVisualizer, TabBar, TextInput, ToggleSwitch, WebView

Product Version : Feathers 1.0.0

Base class for all UI controls. Implements invalidation and sets up some basic template functions like initialize() and draw().

This is a base class for Feathers components that isn't meant to be instantiated directly. It should only be subclassed. For a simple component that will automatically size itself based on its children, and with optional support for layouts, see LayoutGroup.

See also

feathers.controls.LayoutGroup


Public Properties
 PropertyDefined By
  defaultTextEditorFactory : Function
[static] A function used by all UI controls that support text editor to create an ITextEditor instance.
FeathersControl
  defaultTextRendererFactory : Function
[static] A function used by all UI controls that support text renderers to create an ITextRenderer instance.
FeathersControl
  depth : int
[read-only] The component's depth in the display list, relative to the stage.
FeathersControl
  explicitHeight : Number
[read-only] The height value explicitly set by passing a value to the height setter or by calling the setSize() function.
FeathersControl
  explicitMaxHeight : Number
[read-only] The maximum height value explicitly set by passing a value to the maxHeight setter.
FeathersControl
  explicitMaxWidth : Number
[read-only] The maximum width value explicitly set by passing a value to the maxWidth setter.
FeathersControl
  explicitMinHeight : Number
[read-only] The minimum height value explicitly set by passing a value to the minHeight setter.
FeathersControl
  explicitMinWidth : Number
[read-only] The minimum width value explicitly set by passing a value to the minWidth setter.
FeathersControl
  explicitWidth : Number
[read-only] The width value explicitly set by passing a value to the width setter or to the setSize() method.
FeathersControl
  focusManager : IFocusManager
The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface. The current focus manager for this component.
FeathersControl
  focusOwner : IFocusDisplayObject
The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface. Used for associating focusable display objects that are not direct children with an "owner" focusable display object, such as pop-ups.
FeathersControl
  height : Number
[override] The height of the component, in pixels.
FeathersControl
  includeInLayout : Boolean
Determines if the ILayout should use this object or ignore it.
FeathersControl
  isCreated : Boolean
[read-only] Determines if the component has been initialized and validated for the first time.
FeathersControl
  isEnabled : Boolean
Indicates whether the control is interactive or not.
FeathersControl
  isFocusEnabled : Boolean
The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface. Determines if this component can receive focus.
FeathersControl
  isInitialized : Boolean
[read-only] Determines if the component has been initialized yet.
FeathersControl
  isQuickHitAreaEnabled : Boolean
Similar to mouseChildren on the classic display list.
FeathersControl
  layoutData : ILayoutData
Extra parameters associated with this display object that will be used by the layout algorithm.
FeathersControl
  maxHeight : Number
The maximum recommended height to be used for self-measurement and, optionally, by any code that is resizing this component.
FeathersControl
  maxWidth : Number
The maximum recommended width to be used for self-measurement and, optionally, by any code that is resizing this component.
FeathersControl
  minHeight : Number
The minimum recommended height to be used for self-measurement and, optionally, by any code that is resizing this component.
FeathersControl
  minTouchHeight : Number
If using isQuickHitAreaEnabled, and the hit area's height is smaller than this value, it will be expanded.
FeathersControl
  minTouchWidth : Number
If using isQuickHitAreaEnabled, and the hit area's width is smaller than this value, it will be expanded.
FeathersControl
  minWidth : Number
The minimum recommended width to be used for self-measurement and, optionally, by any code that is resizing this component.
FeathersControl
  nextTabFocus : IFocusDisplayObject
The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface. The next object that will receive focus when the tab key is pressed when a focus manager is enabled.
FeathersControl
  previousTabFocus : IFocusDisplayObject
The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface. The previous object that will receive focus when the tab key is pressed while holding shift when a focus manager is enabled.
FeathersControl
  styleName : String
The concatenated styleNameList, with values separated by spaces.
FeathersControl
  styleNameList : TokenList
[read-only] Contains a list of all "styles" assigned to this control.
FeathersControl
  styleProvider : IStyleProvider
When a component initializes, a style provider may be used to set properties that affect the component's visual appearance.
FeathersControl
  toolTip : String
Text to display in a tool tip to when hovering over this component, if the ToolTipManager is enabled.
FeathersControl
  width : Number
[override] The width of the component, in pixels.
FeathersControl
Protected Properties
 PropertyDefined By
  actualHeight : Number = 0
The final height value that should be used for layout.
FeathersControl
  actualMinHeight : Number = 0
The final minimum height value that should be used for layout.
FeathersControl
  actualMinWidth : Number = 0
The final minimum width value that should be used for layout.
FeathersControl
  actualWidth : Number = 0
The final width value that should be used for layout.
FeathersControl
  defaultStyleProvider : IStyleProvider
[read-only] When the FeathersControl constructor is called, the globalStyleProvider property is set to this value.
FeathersControl
Public Methods
 MethodDefined By
  
Constructor.
FeathersControl
  
getBounds(targetSpace:DisplayObject, resultRect:Rectangle = null):Rectangle
[override] Feathers components use an optimized getBounds() implementation that may sometimes behave differently than regular Starling display objects.
FeathersControl
  
hideFocus():void
The implementation of this method is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.
FeathersControl
  
If the component has not yet initialized, initializes immediately.
FeathersControl
  
invalidate(flag:String):void
Call this function to tell the UI control that a redraw is pending.
FeathersControl
  
isInvalid(flag:String = null):Boolean
Indicates whether the control is pending validation or not.
FeathersControl
  
move(x:Number, y:Number):void
Sets both the x and the y positions of the control in a single function call.
FeathersControl
  
Resets the styleProvider property to its default value, which is usually the global style provider for the component.
FeathersControl
  
setSize(width:Number, height:Number):void
Sets both the width and the height of the control in a single function call.
FeathersControl
  
showFocus():void
The implementation of this method is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.
FeathersControl
  
validate():void
Immediately validates the display object, if it is invalid.
FeathersControl
Protected Methods
 MethodDefined By
  
clearInvalidationFlag(flag:String):void
Clears an invalidation flag.
FeathersControl
  
draw():void
Override to customize layout and to adjust properties of children.
FeathersControl
  
focusInHandler(event:Event):void
Default event handler for FeathersEventType.FOCUS_IN that may be overridden in subclasses to perform additional actions when the component receives focus.
FeathersControl
  
focusOutHandler(event:Event):void
Default event handler for FeathersEventType.FOCUS_OUT that may be overridden in subclasses to perform additional actions when the component loses focus.
FeathersControl
  
The next style that is set will not be restricted.
FeathersControl
  
initialize():void
Called the first time that the UI control is added to the stage, and you should override this function to customize the initialization process.
FeathersControl
  
processStyleRestriction(key:Object):Boolean
Used by setters for properties that are considered "styles" to determine if the setter has been called directly on the component or from a style provider.
FeathersControl
  
Updates the focus indicator skin by showing or hiding it and adjusting its position and dimensions.
FeathersControl
  
saveMeasurements(width:Number, height:Number, minWidth:Number = 0, minHeight:Number = 0):Boolean
Saves the dimensions and minimum dimensions calculated for the component.
FeathersControl
  
setInvalidationFlag(flag:String):void
Sets an invalidation flag.
FeathersControl
  
setSizeInternal(width:Number, height:Number, canInvalidate:Boolean):Boolean
Sets the width and height of the control, with the option of invalidating or not.
FeathersControl
Events
 Event Summary Defined By
  Dispatched after the component has validated for the first time.FeathersControl
  Dispatched after initialize() has been called, but before the first time that draw() has been called.FeathersControl
  Dispatched when the width or height of the control changes.FeathersControl
Styles
 StyleDefined By
  
focusIndicatorSkin : DisplayObject
If this component supports focus, this optional skin will be displayed above the component when showFocus() is called.
FeathersControl
  
focusPadding : Number
Quickly sets all focus padding properties to the same value.
FeathersControl
  
The minimum space, in pixels, between the object's bottom edge and the bottom edge of the focus indicator skin.
FeathersControl
  
The minimum space, in pixels, between the object's left edge and the left edge of the focus indicator skin.
FeathersControl
  
The minimum space, in pixels, between the object's right edge and the right edge of the focus indicator skin.
FeathersControl
  
The minimum space, in pixels, between the object's top edge and the top edge of the focus indicator skin.
FeathersControl
Public Constants
 ConstantDefined By
  INVALIDATION_FLAG_ALL : String = "all"
[static] Flag to indicate that everything is invalid and should be redrawn.
FeathersControl
  INVALIDATION_FLAG_DATA : String = "data"
[static] Invalidation flag to indicate that the primary data displayed by the UI control has changed.
FeathersControl
  INVALIDATION_FLAG_FOCUS : String = "focus"
[static] Invalidation flag to indicate that the focus of the UI control has changed.
FeathersControl
  INVALIDATION_FLAG_LAYOUT : String = "layout"
[static] Invalidation flag to indicate that the layout of the UI control has changed.
FeathersControl
  INVALIDATION_FLAG_SCROLL : String = "scroll"
[static] Invalidation flag to indicate that the scroll position of the UI control has changed.
FeathersControl
  INVALIDATION_FLAG_SELECTED : String = "selected"
[static] Invalidation flag to indicate that the selection of the UI control has changed.
FeathersControl
  INVALIDATION_FLAG_SIZE : String = "size"
[static] Invalidation flag to indicate that the dimensions of the UI control have changed.
FeathersControl
  INVALIDATION_FLAG_SKIN : String = "skin"
[static] Invalidation flag to indicate that the skin of the UI control has changed.
FeathersControl
  INVALIDATION_FLAG_STATE : String = "state"
[static] Invalidation flag to indicate that the state has changed.
FeathersControl
  INVALIDATION_FLAG_STYLES : String = "styles"
[static] Invalidation flag to indicate that the styles or visual appearance of the UI control has changed.
FeathersControl
Property Detail
actualHeightproperty
protected var actualHeight:Number = 0

The final height value that should be used for layout. If the height has been explicitly set, then that value is used. If not, the actual height will be calculated automatically. Each component has different automatic sizing behavior, but it's usually based on the component's skin or content, including text or subcomponents.

actualMinHeightproperty 
protected var actualMinHeight:Number = 0

The final minimum height value that should be used for layout. If the minimum height has been explicitly set, then that value is used. If not, the actual minimum height will be calculated automatically. Each component has different automatic sizing behavior, but it's usually based on the component's skin or content, including text or subcomponents.

actualMinWidthproperty 
protected var actualMinWidth:Number = 0

The final minimum width value that should be used for layout. If the minimum width has been explicitly set, then that value is used. If not, the actual minimum width will be calculated automatically. Each component has different automatic sizing behavior, but it's usually based on the component's skin or content, including text or subcomponents.

actualWidthproperty 
protected var actualWidth:Number = 0

The final width value that should be used for layout. If the width has been explicitly set, then that value is used. If not, the actual width will be calculated automatically. Each component has different automatic sizing behavior, but it's usually based on the component's skin or content, including text or subcomponents.

defaultStyleProviderproperty 
defaultStyleProvider:IStyleProvider  [read-only]

When the FeathersControl constructor is called, the globalStyleProvider property is set to this value. May be null.

Typically, a subclass of FeathersControl will override this function to return its static globalStyleProvider value. For instance, feathers.controls.Button overrides this function, and its implementation looks like this:

override protected function get defaultStyleProvider():IStyleProvider
{
    return Button.globalStyleProvider;
}


Implementation
    protected function get defaultStyleProvider():IStyleProvider

See also

defaultTextEditorFactoryproperty 
public static var defaultTextEditorFactory:Function

A function used by all UI controls that support text editor to create an ITextEditor instance. You may replace the default function with your own, if you prefer not to use the StageTextTextEditor.

The function is expected to have the following signature:

function():ITextEditor

See also

defaultTextRendererFactoryproperty 
public static var defaultTextRendererFactory:Function

A function used by all UI controls that support text renderers to create an ITextRenderer instance. You may replace the default function with your own, if you prefer not to use the BitmapFontTextRenderer.

The function is expected to have the following signature:

function():ITextRenderer

See also

depthproperty 
depth:int  [read-only]

The component's depth in the display list, relative to the stage. If the component isn't on the stage, its depth will be -1.

Used by the validation system to validate components from the top down

.


Implementation
    public function get depth():int
explicitHeightproperty 
explicitHeight:Number  [read-only]

The height value explicitly set by passing a value to the height setter or by calling the setSize() function.


Implementation
    public function get explicitHeight():Number
explicitMaxHeightproperty 
explicitMaxHeight:Number  [read-only]

The maximum height value explicitly set by passing a value to the maxHeight setter.

If no value has been passed to the maxHeight setter, this property returns NaN.


Implementation
    public function get explicitMaxHeight():Number
explicitMaxWidthproperty 
explicitMaxWidth:Number  [read-only]

The maximum width value explicitly set by passing a value to the maxWidth setter.

If no value has been passed to the maxWidth setter, this property returns NaN.


Implementation
    public function get explicitMaxWidth():Number
explicitMinHeightproperty 
explicitMinHeight:Number  [read-only]

The minimum height value explicitly set by passing a value to the minHeight setter.

If no value has been passed to the minHeight setter, this property returns NaN.


Implementation
    public function get explicitMinHeight():Number
explicitMinWidthproperty 
explicitMinWidth:Number  [read-only]

The minimum width value explicitly set by passing a value to the minWidth setter.

If no value has been passed to the minWidth setter, this property returns NaN.


Implementation
    public function get explicitMinWidth():Number
explicitWidthproperty 
explicitWidth:Number  [read-only]

The width value explicitly set by passing a value to the width setter or to the setSize() method.


Implementation
    public function get explicitWidth():Number
focusManagerproperty 
focusManager:IFocusManager

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The current focus manager for this component. May be null if no focus manager is enabled.

The default value is null.


Implementation
    public function get focusManager():IFocusManager
    public function set focusManager(value:IFocusManager):void

See also

focusOwnerproperty 
focusOwner:IFocusDisplayObject

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

Used for associating focusable display objects that are not direct children with an "owner" focusable display object, such as pop-ups. A focus manager may use this property to influence the tab order.

In the following example, the focus owner is changed:

object.focusOwner = otherObject;

The default value is null.


Implementation
    public function get focusOwner():IFocusDisplayObject
    public function set focusOwner(value:IFocusDisplayObject):void

See also

heightproperty 
height:Number[override]

The height of the component, in pixels. This could be a value that was set explicitly, or the component will automatically resize if no explicit height value is provided. Each component has a different automatic sizing behavior, but it's usually based on the component's skin or content, including text or subcomponents.

Note: Values of the width and height properties may not be accurate until after validation. If you are seeing width or height values of 0, but you can see something on the screen and know that the value should be larger, it may be because you asked for the dimensions before the component had validated. Call validate() to tell the component to immediately redraw and calculate an accurate values for the dimensions.

In the following example, the height is set to 120 pixels:

control.height = 120;

In the following example, the height is cleared so that the component can automatically measure its own height:

control.height = NaN;


Implementation
    public function get height():Number
    public function set height(value:Number):void

See also

includeInLayoutproperty 
includeInLayout:Boolean

Determines if the ILayout should use this object or ignore it.

In the following example, the display object is excluded from the layout:

object.includeInLayout = false;

The default value is true.


Implementation
    public function get includeInLayout():Boolean
    public function set includeInLayout(value:Boolean):void
isCreatedproperty 
isCreated:Boolean  [read-only]

Determines if the component has been initialized and validated for the first time.

In the following example, we check if the component is created or not, and we listen for an event if it isn't:

if( !control.isCreated )
{
    control.addEventListener( FeathersEventType.CREATION_COMPLETE, creationCompleteHandler );
}


Implementation
    public function get isCreated():Boolean

See also

isEnabledproperty 
isEnabled:Boolean

Indicates whether the control is interactive or not.

In the following example, the control is disabled:

control.isEnabled = false;

The default value is true.


Implementation
    public function get isEnabled():Boolean
    public function set isEnabled(value:Boolean):void
isFocusEnabledproperty 
isFocusEnabled:Boolean

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

Determines if this component can receive focus.

In the following example, the focus is disabled:

object.isFocusEnabled = false;

The default value is true.


Implementation
    public function get isFocusEnabled():Boolean
    public function set isFocusEnabled(value:Boolean):void

See also

isInitializedproperty 
isInitialized:Boolean  [read-only]

Determines if the component has been initialized yet. The initialize() function is called one time only, when the Feathers UI control is added to the display list for the first time.

In the following example, we check if the component is initialized or not, and we listen for an event if it isn't:

if( !control.isInitialized )
{
    control.addEventListener( FeathersEventType.INITIALIZE, initializeHandler );
}


Implementation
    public function get isInitialized():Boolean

See also

isQuickHitAreaEnabledproperty 
isQuickHitAreaEnabled:Boolean

Similar to mouseChildren on the classic display list. If true, children cannot dispatch touch events, but hit tests will be much faster. Easier than overriding hitTest().

In the following example, the quick hit area is enabled:

control.isQuickHitAreaEnabled = true;

The default value is false.


Implementation
    public function get isQuickHitAreaEnabled():Boolean
    public function set isQuickHitAreaEnabled(value:Boolean):void
layoutDataproperty 
layoutData:ILayoutData

Extra parameters associated with this display object that will be used by the layout algorithm.

The default value is null.


Implementation
    public function get layoutData():ILayoutData
    public function set layoutData(value:ILayoutData):void
maxHeightproperty 
maxHeight:Number

The maximum recommended height to be used for self-measurement and, optionally, by any code that is resizing this component. This value is not strictly enforced in all cases. An explicit height value that is larger than maxHeight may be set and will not be affected by the maximum.

In the following example, the maximum width of the control is set to 120 pixels:

control.maxWidth = 120;

The default value is Number.POSITIVE_INFINITY.


Implementation
    public function get maxHeight():Number
    public function set maxHeight(value:Number):void
maxWidthproperty 
maxWidth:Number

The maximum recommended width to be used for self-measurement and, optionally, by any code that is resizing this component. This value is not strictly enforced in all cases. An explicit width value that is larger than maxWidth may be set and will not be affected by the maximum.

In the following example, the maximum width of the control is set to 120 pixels:

control.maxWidth = 120;

The default value is Number.POSITIVE_INFINITY.


Implementation
    public function get maxWidth():Number
    public function set maxWidth(value:Number):void
minHeightproperty 
minHeight:Number

The minimum recommended height to be used for self-measurement and, optionally, by any code that is resizing this component. This value is not strictly enforced in all cases. An explicit height value that is smaller than minHeight may be set and will not be affected by the minimum.

In the following example, the minimum height of the control is set to 120 pixels:

control.minHeight = 120;

The default value is 0.


Implementation
    public function get minHeight():Number
    public function set minHeight(value:Number):void
minTouchHeightproperty 
minTouchHeight:Number

If using isQuickHitAreaEnabled, and the hit area's height is smaller than this value, it will be expanded.

In the following example, the minimum height of the hit area is set to 120 pixels:

control.minTouchHeight = 120;

The default value is 0.


Implementation
    public function get minTouchHeight():Number
    public function set minTouchHeight(value:Number):void
minTouchWidthproperty 
minTouchWidth:Number

If using isQuickHitAreaEnabled, and the hit area's width is smaller than this value, it will be expanded.

In the following example, the minimum width of the hit area is set to 120 pixels:

control.minTouchWidth = 120;

The default value is 0.


Implementation
    public function get minTouchWidth():Number
    public function set minTouchWidth(value:Number):void
minWidthproperty 
minWidth:Number

The minimum recommended width to be used for self-measurement and, optionally, by any code that is resizing this component. This value is not strictly enforced in all cases. An explicit width value that is smaller than minWidth may be set and will not be affected by the minimum.

In the following example, the minimum width of the control is set to 120 pixels:

control.minWidth = 120;

The default value is 0.


Implementation
    public function get minWidth():Number
    public function set minWidth(value:Number):void
nextTabFocusproperty 
nextTabFocus:IFocusDisplayObject

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The next object that will receive focus when the tab key is pressed when a focus manager is enabled. If null, defaults to the next child on the display list.

In the following example, the next tab focus is changed:

object.nextTabFocus = otherObject;

The default value is null.


Implementation
    public function get nextTabFocus():IFocusDisplayObject
    public function set nextTabFocus(value:IFocusDisplayObject):void

See also

previousTabFocusproperty 
previousTabFocus:IFocusDisplayObject

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The previous object that will receive focus when the tab key is pressed while holding shift when a focus manager is enabled. If null, defaults to the previous child on the display list.

In the following example, the previous tab focus is changed:

object.previousTabFocus = otherObject;

The default value is null.


Implementation
    public function get previousTabFocus():IFocusDisplayObject
    public function set previousTabFocus(value:IFocusDisplayObject):void

See also

styleNameproperty 
styleName:String

The concatenated styleNameList, with values separated by spaces. Style names are somewhat similar to classes in CSS selectors. In Feathers, they are a non-unique identifier that can differentiate multiple styles of the same type of UI control. A single control may have many style names, and many controls can share a single style name. A theme or another skinning mechanism may use style names to provide a variety of visual appearances for a single component class.

In general, the styleName property should not be set directly on a Feathers component. You should add and remove style names from the styleNameList property instead.

The default value is "".


Implementation
    public function get styleName():String
    public function set styleName(value:String):void

See also

styleNameListproperty 
styleNameList:TokenList  [read-only]

Contains a list of all "styles" assigned to this control. Names are like classes in CSS selectors. They are a non-unique identifier that can differentiate multiple styles of the same type of UI control. A single control may have many names, and many controls can share a single name. A theme or another skinning mechanism may use style names to provide a variety of visual appearances for a single component class.

Names may be added, removed, or toggled on the styleNameList. Names cannot contain spaces.

In the following example, a name is added to the name list:

control.styleNameList.add( "custom-component-name" );


Implementation
    public function get styleNameList():TokenList

See also

styleProviderproperty 
styleProvider:IStyleProvider

When a component initializes, a style provider may be used to set properties that affect the component's visual appearance.

You can set or replace an existing style provider at any time before a component initializes without immediately affecting the component's visual appearance. After the component initializes, the style provider may still be changed, but any properties that were set by the previous style provider will not be reset to their default values.


Implementation
    public function get styleProvider():IStyleProvider
    public function set styleProvider(value:IStyleProvider):void

See also

toolTipproperty 
toolTip:String

Text to display in a tool tip to when hovering over this component, if the ToolTipManager is enabled.

The default value is null.


Implementation
    public function get toolTip():String
    public function set toolTip(value:String):void

See also

widthproperty 
width:Number[override]

The width of the component, in pixels. This could be a value that was set explicitly, or the component will automatically resize if no explicit width value is provided. Each component has a different automatic sizing behavior, but it's usually based on the component's skin or content, including text or subcomponents.

Note: Values of the width and height properties may not be accurate until after validation. If you are seeing width or height values of 0, but you can see something on the screen and know that the value should be larger, it may be because you asked for the dimensions before the component had validated. Call validate() to tell the component to immediately redraw and calculate an accurate values for the dimensions.

In the following example, the width is set to 120 pixels:

control.width = 120;

In the following example, the width is cleared so that the component can automatically measure its own width:

control.width = NaN;


Implementation
    public function get width():Number
    public function set width(value:Number):void

See also

Constructor Detail
FeathersControl()Constructor
public function FeathersControl()

Constructor.

Method Detail
clearInvalidationFlag()method
protected function clearInvalidationFlag(flag:String):void

Clears an invalidation flag. This will not remove the component from the validation queue. It only clears the flag. A subclass might use this function during draw() to manipulate the flags that its superclass sees.

Parameters

flag:String

draw()method 
protected function draw():void

Override to customize layout and to adjust properties of children. Called when the component validates, if any flags have been marked to indicate that validation is pending.

focusInHandler()method 
protected function focusInHandler(event:Event):void

Default event handler for FeathersEventType.FOCUS_IN that may be overridden in subclasses to perform additional actions when the component receives focus.

Parameters

event:Event

focusOutHandler()method 
protected function focusOutHandler(event:Event):void

Default event handler for FeathersEventType.FOCUS_OUT that may be overridden in subclasses to perform additional actions when the component loses focus.

Parameters

event:Event

getBounds()method 
override public function getBounds(targetSpace:DisplayObject, resultRect:Rectangle = null):Rectangle

Feathers components use an optimized getBounds() implementation that may sometimes behave differently than regular Starling display objects. For instance, filters may need some special customization. If a component's children appear outside of its bounds (such as at negative dimensions), padding should be added to the filter to account for these regions.

Parameters

targetSpace:DisplayObject
 
resultRect:Rectangle (default = null)

Returns
Rectangle
hideFocus()method 
public function hideFocus():void

The implementation of this method is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

If the visual indicator of focus has been displayed by showFocus(), call this function to hide it.

Important: This function will not clear focus from the display object if it has focus. To clear focus from the display object, you should set the focus property on the focus manager to null or another display object.

See also

ignoreNextStyleRestriction()method 
protected function ignoreNextStyleRestriction():void

The next style that is set will not be restricted. This allows components to set defaults by calling the setter while still allowing the style property to be replaced by a theme in the future.

See also

initialize()method 
protected function initialize():void

Called the first time that the UI control is added to the stage, and you should override this function to customize the initialization process. Do things like create children and set up event listeners. After this function is called, FeathersEventType.INITIALIZE is dispatched.

See also

initializeNow()method 
public function initializeNow():void

If the component has not yet initialized, initializes immediately. The initialize() function will be called, and the FeathersEventType.INITIALIZE event will be dispatched. Then, if the component has a style provider, it will be applied. The component will not validate, though. To initialize and validate immediately, call validate() instead.

See also

invalidate()method 
public function invalidate(flag:String):void

Call this function to tell the UI control that a redraw is pending. The redraw will happen immediately before Starling renders the UI control to the screen. The validation system exists to ensure that multiple properties can be set together without redrawing multiple times in between each property change.

If you cannot wait until later for the validation to happen, you can call validate() to redraw immediately. As an example, you might want to validate immediately if you need to access the correct width or height values of the UI control, since these values are calculated during validation.

Parameters

flag:String (default = NaN)

See also

isInvalid()method 
public function isInvalid(flag:String = null):Boolean

Indicates whether the control is pending validation or not. By default, returns true if any invalidation flag has been set. If you pass in a specific flag, returns true only if that flag has been set (others may be set too, but it checks the specific flag only. If all flags have been marked as invalid, always returns true.

Parameters

flag:String (default = null)

Returns
Boolean
move()method 
public function move(x:Number, y:Number):void

Sets both the x and the y positions of the control in a single function call.

Parameters

x:Number
 
y:Number

See also

processStyleRestriction()method 
protected function processStyleRestriction(key:Object):Boolean

Used by setters for properties that are considered "styles" to determine if the setter has been called directly on the component or from a style provider. A style provider is typically associated with a theme. When a style is set directly on the component (outside of a style provider), then any attempts by the style provider to set the style later will be ignored. This allows developers to customize a component's styles directly without worrying about conflicts from the style provider or theme.

If a style provider is currently applying styles to the component, returns true if the style is restricted or false if it may be set.

If the style setter is called outside of a style provider, marks the style as restricted and returns false.

The key parameter should be a unique value for each separate style. In most cases, processStyleRestriction() will be called in the style property setter, so arguments.callee is recommended. Alternatively, a unique string value may be used instead.

The following example shows how to use processStyleRestriction() in a style property setter:

private var _customStyle:Object;
public function get customStyle():Object
{
    return this._customStyle;
}
public function set customStyle( value:Object ):void
{
    if( this.processStyleRestriction( arguments.callee ) )
    {
        // if a style is restricted, don't set it
        return;
    }

    this._customStyle = value;
}

Parameters

key:Object

Returns
Boolean

See also

refreshFocusIndicator()method 
protected function refreshFocusIndicator():void

Updates the focus indicator skin by showing or hiding it and adjusting its position and dimensions. This function is not called automatically. Components that support focus should call this function at an appropriate point within the draw() function. This function may be overridden if the default behavior is not desired.

resetStyleProvider()method 
public function resetStyleProvider():void

Resets the styleProvider property to its default value, which is usually the global style provider for the component.

See also

saveMeasurements()method 
protected function saveMeasurements(width:Number, height:Number, minWidth:Number = 0, minHeight:Number = 0):Boolean

Saves the dimensions and minimum dimensions calculated for the component. Returns true if the reported values have changed and Event.RESIZE was dispatched.

Parameters

width:Number
 
height:Number
 
minWidth:Number (default = 0)
 
minHeight:Number (default = 0)

Returns
Boolean
setInvalidationFlag()method 
protected function setInvalidationFlag(flag:String):void

Sets an invalidation flag. This will not add the component to the validation queue. It only sets the flag. A subclass might use this function during draw() to manipulate the flags that its superclass sees.

Parameters

flag:String

setSize()method 
public function setSize(width:Number, height:Number):void

Sets both the width and the height of the control in a single function call.

Parameters

width:Number
 
height:Number

See also

setSizeInternal()method 
protected function setSizeInternal(width:Number, height:Number, canInvalidate:Boolean):Boolean

Sets the width and height of the control, with the option of invalidating or not. Intended to be used when the width and height values have not been set explicitly, and the UI control needs to measure itself and choose an "ideal" size.

Parameters

width:Number
 
height:Number
 
canInvalidate:Boolean

Returns
Boolean
showFocus()method 
public function showFocus():void

The implementation of this method is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

If the object has focus, an additional visual indicator may optionally be displayed to highlight the object. Calling this function may have no effect. It's merely a suggestion to the object.

Important: This function will not give focus to the display object if it doesn't have focus. To give focus to the display object, you should set the focus property on the focus manager.

object.focusManager.focus = object;

See also

validate()method 
public function validate():void

Immediately validates the display object, if it is invalid. The validation system exists to postpone updating a display object after properties are changed until until the last possible moment the display object is rendered. This allows multiple properties to be changed at a time without requiring a full update every time.

See also

Event Detail
creationComplete Event
Event Object Type: starling.events.Event
Event.type property = feathers.events.FeathersEventType.CREATION_COMPLETE

Dispatched after the component has validated for the first time. Both initialize() and draw() will have been called, and all children will have been created.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
datanull
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.

The FeathersEventType.CREATION_COMPLETE event type is meant to be used when an IFeathersControl has finished validating for the first time. A well-designed component will have created all of its children and it will be fully ready for user interaction.
initialize Event  
Event Object Type: starling.events.Event
Event.type property = feathers.events.FeathersEventType.INITIALIZE

Dispatched after initialize() has been called, but before the first time that draw() has been called.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
datanull
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.

The FeathersEventType.INITIALIZE event type is meant to be used when an IFeathersControl has finished running its initialize() function.
resize Event  
Event Object Type: starling.events.Event
Event.type property = starling.events.Event.RESIZE

Dispatched when the width or height of the control changes.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
datanull
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.

Style Detail
focusPaddingLeftstyle
focusPaddingLeft:Number

The minimum space, in pixels, between the object's left edge and the left edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The following example gives the focus indicator skin -2 pixels of padding on the right edge only:

control.focusPaddingLeft = -2;

The default value is 0.

See also

focusPaddingBottomstyle 
focusPaddingBottom:Number

The minimum space, in pixels, between the object's bottom edge and the bottom edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The following example gives the focus indicator skin -2 pixels of padding on the bottom edge only:

control.focusPaddingBottom = -2;

The default value is 0.

See also

focusPaddingRightstyle 
focusPaddingRight:Number

The minimum space, in pixels, between the object's right edge and the right edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The following example gives the focus indicator skin -2 pixels of padding on the right edge only:

control.focusPaddingRight = -2;

The default value is 0.

See also

focusPaddingTopstyle 
focusPaddingTop:Number

The minimum space, in pixels, between the object's top edge and the top edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The following example gives the focus indicator skin -2 pixels of padding on the top edge only:

control.focusPaddingTop = -2;

The default value is 0.

See also

focusPaddingstyle 
focusPadding:Number

Quickly sets all focus padding properties to the same value. The focusPadding getter always returns the value of focusPaddingTop, but the other focus padding values may be different.

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

The following example gives the button 2 pixels of focus padding on all sides:

control.focusPadding = 2;

The default value is 0.

See also

focusIndicatorSkinstyle 
focusIndicatorSkin:DisplayObject

If this component supports focus, this optional skin will be displayed above the component when showFocus() is called. The focus indicator skin is not always displayed when the component has focus. Typically, if the component receives focus from a touch, the focus indicator is not displayed.

The touchable of this skin will always be set to false so that it does not "steal" touches from the component or its sub-components. This skin will not affect the dimensions of the component or its hit area. It is simply a visual indicator of focus.

The implementation of this property is provided for convenience, but it cannot be used unless a subclass implements the IFocusDisplayObject interface.

In the following example, the focus indicator skin is set:

control.focusIndicatorSkin = new Image( texture );

The default value is null.

See also

Constant Detail
INVALIDATION_FLAG_ALLConstant
public static const INVALIDATION_FLAG_ALL:String = "all"

Flag to indicate that everything is invalid and should be redrawn.

INVALIDATION_FLAG_DATAConstant 
public static const INVALIDATION_FLAG_DATA:String = "data"

Invalidation flag to indicate that the primary data displayed by the UI control has changed.

INVALIDATION_FLAG_FOCUSConstant 
public static const INVALIDATION_FLAG_FOCUS:String = "focus"

Invalidation flag to indicate that the focus of the UI control has changed.

INVALIDATION_FLAG_LAYOUTConstant 
public static const INVALIDATION_FLAG_LAYOUT:String = "layout"

Invalidation flag to indicate that the layout of the UI control has changed.

INVALIDATION_FLAG_SCROLLConstant 
public static const INVALIDATION_FLAG_SCROLL:String = "scroll"

Invalidation flag to indicate that the scroll position of the UI control has changed.

INVALIDATION_FLAG_SELECTEDConstant 
public static const INVALIDATION_FLAG_SELECTED:String = "selected"

Invalidation flag to indicate that the selection of the UI control has changed.

INVALIDATION_FLAG_SIZEConstant 
public static const INVALIDATION_FLAG_SIZE:String = "size"

Invalidation flag to indicate that the dimensions of the UI control have changed.

INVALIDATION_FLAG_SKINConstant 
public static const INVALIDATION_FLAG_SKIN:String = "skin"

Invalidation flag to indicate that the skin of the UI control has changed.

INVALIDATION_FLAG_STATEConstant 
public static const INVALIDATION_FLAG_STATE:String = "state"

Invalidation flag to indicate that the state has changed. Used by isEnabled, but may be used for other control states too.

See also

INVALIDATION_FLAG_STYLESConstant 
public static const INVALIDATION_FLAG_STYLES:String = "styles"

Invalidation flag to indicate that the styles or visual appearance of the UI control has changed.