Package | feathers.skins |
Class | public class ImageSkin |
Inheritance | ImageSkin ![]() ![]() ![]() ![]() ![]() ![]() |
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 | ||
---|---|---|---|
![]() | alpha : Number The opacity of the object. | DisplayObject | |
![]() | base : DisplayObject [read-only] The topmost object in the display tree the object is part of. | DisplayObject | |
![]() | blendMode : String The blend mode determines how the object is blended with the objects underneath. | DisplayObject | |
![]() | bounds : Rectangle [read-only] The bounds of the object relative to the local coordinates of the parent. | DisplayObject | |
defaultColor : uint
The default color to use to tint the skin. | ImageSkin | ||
![]() | defaultStyle : Class [static] The default style used for meshes if no specific style is provided. | Mesh | |
![]() | defaultStyleFactory : Function [static] A factory method that is used to create the 'MeshStyle' for a mesh if no specific
style is provided. | Mesh | |
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 | ||
![]() | filter : FragmentFilter The filter that is attached to the display object. | DisplayObject | |
![]() | height : Number The height of the object in pixels. | DisplayObject | |
![]() | is3D : Boolean [read-only] Indicates if this object or any of its parents is a 'Sprite3D' object. | DisplayObject | |
![]() | mask : DisplayObject The display object that acts as a mask for the current object. | DisplayObject | |
![]() | maskInverted : Boolean Indicates if the masked region of this object is set to be inverted. | DisplayObject | |
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 | ||
![]() | name : String The name of the display object (default: null). | DisplayObject | |
![]() | numIndices : int [read-only] The total number of indices referencing vertices. | Mesh | |
![]() | numTriangles : int [read-only] The total number of triangles in this mesh. | Mesh | |
![]() | numVertices : int [read-only] The total number of vertices in the mesh. | Mesh | |
![]() | parent : DisplayObjectContainer [read-only] The display object container that contains this display object. | DisplayObject | |
![]() | pivotX : Number The x coordinate of the object's origin in its own coordinate space (default: 0). | DisplayObject | |
![]() | pivotY : Number The y coordinate of the object's origin in its own coordinate space (default: 0). | DisplayObject | |
![]() | pixelSnapping : Boolean Controls whether or not the instance snaps to the nearest pixel. | Mesh | |
![]() | requiresRedraw : Boolean [read-only] Indicates if the object needs to be redrawn in the upcoming frame, i.e. | DisplayObject | |
![]() | root : DisplayObject [read-only] The root object the display object is connected to (i.e. | DisplayObject | |
![]() | rotation : Number The rotation of the object in radians. | DisplayObject | |
![]() | scale : Number Sets both 'scaleX' and 'scaleY' to the same value. | DisplayObject | |
![]() | scale9Grid : Rectangle The current scaling grid that is in effect. | Image | |
![]() | scaleX : Number The horizontal scale factor. | DisplayObject | |
![]() | scaleY : Number The vertical scale factor. | DisplayObject | |
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 | ||
![]() | skewX : Number The horizontal skew angle in radians. | DisplayObject | |
![]() | skewY : Number The vertical skew angle in radians. | DisplayObject | |
![]() | stage : Stage [read-only] The stage the display object is connected to, or null if it is not connected
to the stage. | DisplayObject | |
stateContext : IStateContext
When the skin observes a state context, the skin may change its
Texture based on the current state of that context. | ImageSkin | ||
![]() | style : MeshStyle The style that is used to render the mesh. | Mesh | |
![]() | texture : Texture [override] The texture that is mapped to the quad (or null, if there is none). | Quad | |
![]() | textureRepeat : Boolean Indicates if pixels at the edges will be repeated or clamped. | Mesh | |
![]() | textureSmoothing : String The smoothing filter that is used for the texture. | Mesh | |
![]() | tileGrid : Rectangle The current tiling grid that is in effect. | Image | |
![]() | touchable : Boolean Indicates if this object (and its children) will receive touch events. | DisplayObject | |
![]() | transformationMatrix : Matrix The transformation matrix of the object relative to its parent. | DisplayObject | |
![]() | transformationMatrix3D : Matrix3D [read-only] The 3D transformation matrix of the object relative to its parent. | DisplayObject | |
![]() | useHandCursor : Boolean Indicates if the mouse cursor should transform into a hand while it's over the sprite. | DisplayObject | |
![]() | vertexFormat : VertexDataFormat [read-only] The format used to store the vertices. | Mesh | |
![]() | visible : Boolean The visibility of the object. | DisplayObject | |
![]() | width : Number The width of the object in pixels. | DisplayObject | |
![]() | x : Number The x coordinate of the object relative to the local coordinates of the parent. | DisplayObject | |
![]() | y : Number The y coordinate of the object relative to the local coordinates of the parent. | DisplayObject |
Method | Defined By | ||
---|---|---|---|
Constructor. | ImageSkin | ||
![]() | addEventListener(type:String, listener:Function):void [override] Registers an event listener at a certain object. | DisplayObject | |
![]() | alignPivot(horizontalAlign:String = center, verticalAlign:String = center):void Moves the pivot point to a certain position within the local coordinate system
of the object. | DisplayObject | |
![]() | automateSetupForTexture(texture:Texture, onAssign:Function, onRelease:Function = null):void [static] Injects code that is called by all instances whenever the given texture is assigned or replaced. | Image | |
![]() | bindPivotPointToTexture(texture:Texture, pivotX:Number, pivotY:Number):void [static] Binds the given pivot point to the given texture so that any image which displays the texture will
automatically use the pivot point. | Image | |
![]() | bindScale9GridToTexture(texture:Texture, scale9Grid:Rectangle):void [static] Binds the given scaling grid to the given texture so that any image which displays the texture will
automatically use the grid. | Image | |
![]() | [static] Creates a new instance of the current default MeshStyle. | Mesh | |
![]() | dispatchEvent(event:Event):void Dispatches an event to all objects that have registered listeners for its type. | EventDispatcher | |
![]() | dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void Dispatches an event with the given parameters to all objects that have registered
listeners for the given type. | EventDispatcher | |
![]() | dispose():void [override] Disposes all resources of the display object. | Mesh | |
![]() | drawToBitmapData(out:BitmapData = null, color:uint = 0x0, alpha:Number = 0.0):BitmapData Draws the object into a BitmapData object. | DisplayObject | |
![]() | [static] Creates a mesh from the specified polygon. | Mesh | |
![]() | [static] Creates a quad from the given texture. | Quad | |
![]() | getBounds(targetSpace:DisplayObject, out:Rectangle = null):Rectangle [override] Returns a rectangle that completely encloses the object as it appears in another
coordinate system. | Quad | |
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 | ||
![]() | getTexCoords(vertexID:int, out:Point = null):Point Returns the texture coordinates of the vertex at the specified index. | Mesh | |
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 | ||
![]() | getTransformationMatrix(targetSpace:DisplayObject, out:Matrix = null):Matrix Creates a matrix that represents the transformation from the local coordinate system
to another. | DisplayObject | |
![]() | getTransformationMatrix3D(targetSpace:DisplayObject, out:Matrix3D = null):Matrix3D Creates a matrix that represents the transformation from the local coordinate system
to another. | DisplayObject | |
![]() | getVertexAlpha(vertexID:int):Number Returns the alpha value of the vertex at the specified index. | Mesh | |
![]() | getVertexColor(vertexID:int):uint Returns the RGB color of the vertex at the specified index. | Mesh | |
![]() | getVertexPosition(vertexID:int, out:Point = null):Point The position of the vertex at the specified index, in the mesh's local coordinate
system. | Mesh | |
![]() | globalToLocal(globalPoint:Point, out:Point = null):Point Transforms a point from global (stage) coordinates to the local coordinate system. | DisplayObject | |
![]() | globalToLocal3D(globalPoint:Point, out:Vector3D = null):Vector3D Transforms a point from global (stage) coordinates to the 3D local coordinate system. | DisplayObject | |
![]() | hasEventListener(type:String, listener:Function = null):Boolean If called with one argument, figures out if there are any listeners registered for
the given event type. | EventDispatcher | |
![]() | hitTest(localPoint:Point):DisplayObject [override] Returns the object that is found topmost beneath a point in local coordinates, or nil
if the test fails. | Quad | |
![]() | hitTestMask(localPoint:Point):Boolean Checks if a certain point is inside the display object's mask. | DisplayObject | |
![]() | local3DToGlobal(localPoint:Vector3D, out:Point = null):Point Transforms a 3D point from the local coordinate system to global (stage) coordinates. | DisplayObject | |
![]() | localToGlobal(localPoint:Point, out:Point = null):Point Transforms a point from the local coordinate system to global (stage) coordinates. | DisplayObject | |
![]() | readjustSize(width:Number = -1, height:Number = -1):void Readjusts the dimensions of the quad. | Quad | |
![]() | removeEventListener(type:String, listener:Function):void [override] Removes an event listener from the object. | DisplayObject | |
![]() | removeEventListeners(type:String = null):void [override] Removes all event listeners with a certain type, or all of them if type is null. | DisplayObject | |
![]() | removeFromParent(dispose:Boolean = false):void Removes the object from its parent, if it has one, and optionally disposes it. | DisplayObject | |
![]() | removeSetupForTexture(texture:Texture, onAssign:Function, onRelease:Function = null):void [static] Removes specific setup functions for the given texture. | Image | |
![]() | [override] Renders the display object with the help of a painter object. | Mesh | |
![]() | resetSetupForTexture(texture:Texture):void [static] Removes all custom setup functions for the given texture, including those created via
'bindScale9GridToTexture' and 'bindPivotPointToTexture'. | Image | |
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 | ||
![]() | setIndexDataChanged():void This method is called whenever the mesh's index data was changed. | Mesh | |
![]() | setRequiresRedraw():void Forces the object to be redrawn in the next frame. | DisplayObject | |
![]() | Sets the style that is used to render the mesh. | Mesh | |
![]() | setTexCoords(vertexID:int, u:Number, v:Number):void Sets the texture coordinates of the vertex at the specified index to the given values. | Mesh | |
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 | ||
![]() | setVertexAlpha(vertexID:int, alpha:Number):void Sets the alpha value of the vertex at the specified index to a certain value. | Mesh | |
![]() | setVertexColor(vertexID:int, color:uint):void Sets the RGB color of the vertex at the specified index to a certain value. | Mesh | |
![]() | setVertexDataChanged():void This method is called whenever the mesh's vertex data was changed. | Mesh | |
![]() | setVertexPosition(vertexID:int, x:Number, y:Number):void | Mesh |
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):void
See 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):void
See 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):void
See 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):void
See 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():Number
See 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():Number
See 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():Number
See 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():Number
See 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():Number
See 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():Number
See also
maxHeight | property |
maxHeight:Number
The maximum height of the component.
public function get maxHeight():Number
public function set maxHeight(value:Number):void
maxWidth | property |
maxWidth:Number
The maximum width of the component.
public function get maxWidth():Number
public function set maxWidth(value:Number):void
minHeight | property |
minHeight:Number
The minimum height of the component.
public function get minHeight():Number
public function set minHeight(value:Number):void
minTouchHeight | property |
minTouchHeight:Number
If 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:Number
If 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:Number
The 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):void
See 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):void
See 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):void
See 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