| Package | feathers.skins |
| Class | public class ImageSkin |
| Inheritance | ImageSkin starling.display.Image |
| Implements | IMeasureDisplayObject, IStateObserver |
| Product Version : | Feathers 3.0.0 |
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
| Property | Defined 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 | ||
| minTouchHeight : Number
If the skin's height is smaller than this value, the hit area will be expanded. | ImageSkin | ||
| minTouchWidth : Number
If the skin's width is smaller than this value, the hit area will be expanded. | 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 | ||
| Method | Defined 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 | ||
| defaultColor | property |
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.
To set the color of an ImageSkin, the
defaultColor property should be preferred over the
color property defined on
starling.display.Mesh. The ImageSkin
will manage the color property internally.
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 0xffffff.
public function get defaultColor():uint public function set defaultColor(value:uint):voidSee also
| defaultTexture | property |
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.
public function get defaultTexture():Texture public function set defaultTexture(value:Texture):voidSee also
| disabledColor | property |
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.
public function get disabledColor():uint public function set disabledColor(value:uint):voidSee also
| disabledTexture | property |
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.
public function get disabledTexture():Texture public function set disabledTexture(value:Texture):voidSee also
| explicitHeight | property |
explicitHeight:Number [read-only]
The value passed to the height property setter. If the
height property has not be set, returns
NaN.
public function get explicitHeight():NumberSee also
| explicitMaxHeight | property |
explicitMaxHeight:Number [read-only]
The value passed to the maxHeight property setter. If
the maxHeight property has not be set, returns
NaN.
public function get explicitMaxHeight():NumberSee also
| explicitMaxWidth | property |
explicitMaxWidth:Number [read-only]
The value passed to the maxWidth property setter. If the
maxWidth property has not be set, returns
NaN.
public function get explicitMaxWidth():NumberSee also
| explicitMinHeight | property |
explicitMinHeight:Number [read-only]
The value passed to the minHeight property setter. If
the minHeight property has not be set, returns
NaN.
public function get explicitMinHeight():NumberSee also
| explicitMinWidth | property |
explicitMinWidth:Number [read-only]
The value passed to the minWidth property setter. If the
minWidth property has not be set, returns
NaN.
public function get explicitMinWidth():NumberSee also
| explicitWidth | property |
explicitWidth:Number [read-only]
The value passed to the width property setter. If the
width property has not be set, returns NaN.
public function get explicitWidth():NumberSee also
| maxHeight | property |
maxHeight:NumberThe maximum height of the component.
public function get maxHeight():Number public function set maxHeight(value:Number):void| maxWidth | property |
maxWidth:NumberThe maximum width of the component.
public function get maxWidth():Number public function set maxWidth(value:Number):void| minHeight | property |
minHeight:NumberThe minimum height of the component.
public function get minHeight():Number public function set minHeight(value:Number):void| minTouchHeight | property |
minTouchHeight:NumberIf the skin's height is smaller than this value, the hit area will be expanded.
In the following example, the minimum height of the hit area is set to 120 pixels:
skin.minTouchHeight = 120;
The default value is 0.
public function get minTouchHeight():Number public function set minTouchHeight(value:Number):void| minTouchWidth | property |
minTouchWidth:NumberIf the skin's width is smaller than this value, the hit area will be expanded.
In the following example, the minimum width of the hit area is set to 120 pixels:
skin.minTouchWidth = 120;
The default value is 0.
public function get minTouchWidth():Number public function set minTouchWidth(value:Number):void| minWidth | property |
minWidth:NumberThe minimum width of the component.
public function get minWidth():Number public function set minWidth(value:Number):void| selectedColor | property |
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.
public function get selectedColor():uint public function set selectedColor(value:uint):voidSee also
| selectedTexture | property |
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.
public function get selectedTexture():Texture public function set selectedTexture(value:Texture):voidSee also
| stateContext | property |
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.
public function get stateContext():IStateContext public function set stateContext(value:IStateContext):voidSee also
| ImageSkin | () | Constructor |
public function ImageSkin(defaultTexture:Texture = null)Constructor.
ParametersdefaultTexture:Texture (default = null) |
| 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 |
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 |
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