Packagefeathers.skins
Classpublic class ImageSkin
InheritanceImageSkin Inheritance starling.display.Image
Implements IMeasureDisplayObject, IStateObserver

Product Version : Feathers 3.0.0

A skin for Feathers components that displays a texture. Has the ability to change its texture based on the current state of the Feathers component that is being skinned.
var skin:ImageSkin = new ImageSkin( upTexture );
skin.setTextureForState( ButtonState.DOWN, downTexture );
skin.setTextureForState( ButtonState.HOVER, hoverTexture );

var button:Button = new Button();
button.label = "Click Me";
button.defaultSkin = skin;
this.addChild( button );

See also

starling.display.Image


Public Properties
 PropertyDefined By
  defaultColor : uint
The default color to use to tint the skin.
ImageSkin
  defaultTexture : Texture
The default texture that the skin will display.
ImageSkin
  disabledColor : uint
The color to tint the skin when the stateContext is an IFeathersControl and its isEnabled property is false.
ImageSkin
  disabledTexture : Texture
The texture to display when the stateContext is an IFeathersControl and its isEnabled property is false.
ImageSkin
  explicitHeight : Number
[read-only] The value passed to the height property setter.
ImageSkin
  explicitMaxHeight : Number
[read-only] The value passed to the maxHeight property setter.
ImageSkin
  explicitMaxWidth : Number
[read-only] The value passed to the maxWidth property setter.
ImageSkin
  explicitMinHeight : Number
[read-only] The value passed to the minHeight property setter.
ImageSkin
  explicitMinWidth : Number
[read-only] The value passed to the minWidth property setter.
ImageSkin
  explicitWidth : Number
[read-only] The value passed to the width property setter.
ImageSkin
  maxHeight : Number
The maximum height of the component.
ImageSkin
  maxWidth : Number
The maximum width of the component.
ImageSkin
  minHeight : Number
The minimum height of the component.
ImageSkin
  minWidth : Number
The minimum width of the component.
ImageSkin
  selectedColor : uint
The color to tint the skin when the stateContext is an IToggle instance and its isSelected property is true.
ImageSkin
  selectedTexture : Texture
The texture to display when the stateContext is an IToggle instance and its isSelected property is true.
ImageSkin
  stateContext : IStateContext
When the skin observes a state context, the skin may change its Texture based on the current state of that context.
ImageSkin
Public Methods
 MethodDefined By
  
ImageSkin(defaultTexture:Texture = null)
Constructor.
ImageSkin
  
getColorForState(state:String):uint
Gets the color to be used by the skin when the context's currentState property matches the specified state value.
ImageSkin
  
getTextureForState(state:String):Texture
Gets the texture to be used by the skin when the context's currentState property matches the specified state value.
ImageSkin
  
setColorForState(state:String, color:uint):void
Sets the color to be used by the skin when the context's currentState property matches the specified state value.
ImageSkin
  
setTextureForState(state:String, texture:Texture):void
Sets the texture to be used by the skin when the context's currentState property matches the specified state value.
ImageSkin
Property Detail
defaultColorproperty
defaultColor:uint

The default color to use to tint the skin. If the component being skinned supports states, the color for a specific state may be specified using the setColorForState() method. If no color has been specified for the current state, the default color will be used.

A value of uint.MAX_VALUE means that the color property will not be changed when the context's state changes.

In the following example, the default color is specified:

var skin:ImageSkin = new ImageSkin();
skin.defaultColor = 0x9f0000;

The default value is uint.MAX_VALUE.


Implementation
    public function get defaultColor():uint
    public function set defaultColor(value:uint):void

See also

defaultTextureproperty 
defaultTexture:Texture

The default texture that the skin will display. If the component being skinned supports states, the texture for a specific state may be specified using the setTextureForState() method. If no texture has been specified for the current state, the default texture will be used.

In the following example, the default texture is specified in the constructor:

var skin:ImageSkin = new ImageSkin( texture );

In the following example, the default texture is specified by setting the property:

var skin:ImageSkin = new ImageSkin();
skin.defaultTexture = texture;

The default value is null.


Implementation
    public function get defaultTexture():Texture
    public function set defaultTexture(value:Texture):void

See also

disabledColorproperty 
disabledColor:uint

The color to tint the skin when the stateContext is an IFeathersControl and its isEnabled property is false. If a color has been specified for the context's current state with setColorForState(), it will take precedence over the disabledColor.

A value of uint.MAX_VALUE means that the disabledColor property cannot affect the tint when the context's state changes.

In the following example, the disabled color is changed:

var skin:ImageSkin = new ImageSkin();
skin.defaultColor = 0xffffff;
skin.disabledColor = 0x999999;
var button:Button = new Button();
button.defaultSkin = skin;
button.isEnabled = false;

The default value is uint.MAX_VALUE.


Implementation
    public function get disabledColor():uint
    public function set disabledColor(value:uint):void

See also

disabledTextureproperty 
disabledTexture:Texture

The texture to display when the stateContext is an IFeathersControl and its isEnabled property is false. If a texture has been specified for the context's current state with setTextureForState(), it will take precedence over the disabledTexture.

In the following example, the disabled texture is changed:

var skin:ImageSkin = new ImageSkin( upTexture );
skin.disabledTexture = disabledTexture;

var button:Button = new Button();
button.defaultSkin = skin;
button.isEnabled = false;

The default value is null.


Implementation
    public function get disabledTexture():Texture
    public function set disabledTexture(value:Texture):void

See also

explicitHeightproperty 
explicitHeight:Number  [read-only]

The value passed to the height property setter. If the height property has not be set, returns NaN.


Implementation
    public function get explicitHeight():Number

See also

explicitMaxHeightproperty 
explicitMaxHeight:Number  [read-only]

The value passed to the maxHeight property setter. If the maxHeight property has not be set, returns NaN.


Implementation
    public function get explicitMaxHeight():Number

See also

explicitMaxWidthproperty 
explicitMaxWidth:Number  [read-only]

The value passed to the maxWidth property setter. If the maxWidth property has not be set, returns NaN.


Implementation
    public function get explicitMaxWidth():Number

See also

explicitMinHeightproperty 
explicitMinHeight:Number  [read-only]

The value passed to the minHeight property setter. If the minHeight property has not be set, returns NaN.


Implementation
    public function get explicitMinHeight():Number

See also

explicitMinWidthproperty 
explicitMinWidth:Number  [read-only]

The value passed to the minWidth property setter. If the minWidth property has not be set, returns NaN.


Implementation
    public function get explicitMinWidth():Number

See also

explicitWidthproperty 
explicitWidth:Number  [read-only]

The value passed to the width property setter. If the width property has not be set, returns NaN.


Implementation
    public function get explicitWidth():Number

See also

maxHeightproperty 
maxHeight:Number

The maximum height of the component.


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

The maximum width of the component.


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

The minimum height of the component.


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

The minimum width of the component.


Implementation
    public function get minWidth():Number
    public function set minWidth(value:Number):void
selectedColorproperty 
selectedColor:uint

The color to tint the skin when the stateContext is an IToggle instance and its isSelected property is true. If a color has been specified for the context's current state with setColorForState(), it will take precedence over the selectedColor.

In the following example, the selected color is changed:

var skin:ImageSkin = new ImageSkin();
skin.defaultColor = 0xffffff;
skin.selectedColor = 0xffcc00;
var toggleButton:ToggleButton = new ToggleButton();
toggleButton.defaultSkin = skin;
toggleButton.isSelected = true;

The default value is uint.MAX_VALUE.


Implementation
    public function get selectedColor():uint
    public function set selectedColor(value:uint):void

See also

selectedTextureproperty 
selectedTexture:Texture

The texture to display when the stateContext is an IToggle instance and its isSelected property is true. If a texture has been specified for the context's current state with setTextureForState(), it will take precedence over the selectedTexture.

In the following example, the selected texture is changed:

var skin:ImageSkin = new ImageSkin( upTexture );
skin.selectedTexture = selectedTexture;
var toggleButton:ToggleButton = new ToggleButton();
toggleButton.defaultSkin = skin;
toggleButton.isSelected = true;

The default value is null.


Implementation
    public function get selectedTexture():Texture
    public function set selectedTexture(value:Texture):void

See also

stateContextproperty 
stateContext:IStateContext

When the skin observes a state context, the skin may change its Texture based on the current state of that context. Typically, a relevant component will automatically assign itself as the state context of its skin, so this property is considered to be for internal use only.

The default value is null.


Implementation
    public function get stateContext():IStateContext
    public function set stateContext(value:IStateContext):void

See also

Constructor Detail
ImageSkin()Constructor
public function ImageSkin(defaultTexture:Texture = null)

Constructor.

Parameters
defaultTexture:Texture (default = null)
Method Detail
getColorForState()method
public function getColorForState(state:String):uint

Gets the color to be used by the skin when the context's currentState property matches the specified state value.

If a color is not defined for a specific state, returns uint.MAX_VALUE.

Parameters

state:String

Returns
uint

See also

getTextureForState()method 
public function getTextureForState(state:String):Texture

Gets the texture to be used by the skin when the context's currentState property matches the specified state value.

If a texture is not defined for a specific state, returns null.

Parameters

state:String

Returns
Texture

See also

setColorForState()method 
public function setColorForState(state:String, color:uint):void

Sets the color to be used by the skin when the context's currentState property matches the specified state value.

If a color is not defined for a specific state, the value of the defaultTexture property will be used instead.

To clear a state's color, pass in uint.MAX_VALUE.

Parameters

state:String
 
color:uint

See also

setTextureForState()method 
public function setTextureForState(state:String, texture:Texture):void

Sets the texture to be used by the skin when the context's currentState property matches the specified state value.

If a texture is not defined for a specific state, the value of the defaultTexture property will be used instead.

Parameters

state:String
 
texture:Texture

See also