Sprite


Inheritance Sprite View Module hilo/view/Sprite Requires hilo/core/Hilo, hilo/core/Class, hilo/view/View, hilo/view/Drawable Source Sprite.js
Sprite animation class.

Properties

Show Inherited Properties
Property Defined
currentFrame:number
Current showing frame index, range from 0, readoly!
Sprite
interval:number
Interval between sprite animation frames.
Sprite
loop:boolean
Is sprite play in loop, default value is false.
Sprite
onEnterFrame:Function
Sprite
paused:boolean
Is sprite paused, default value is false.
Sprite
timeBased:boolean
Is sprite animate base on time, default value is false (base on frame).
Sprite

Methods

Show Inherited Methods
Method Defined
Sprite(properties)
Constructor
Sprite
addFrame(frame:Object, startIndex:Int):Sprite
Sprite
getFrame(indexOrName:Object):Object
Sprite
getFrameIndex(frameValue:Object):Object
Sprite
getNumFrames():Uint
Sprite
goto(indexOrName:Object, pause:Boolean):Sprite
Sprite
play():Sprite
Sprite
setFrame(frame:Object, index:Int):Sprite
Sprite
setFrameCallback(frame:Int|String, callback:Function):Sprite
Sprite
stop():Sprite
Sprite

Property Detail

currentFrame:number
Current showing frame index, range from 0, readoly!
interval:number
Interval between sprite animation frames. If timeBased is true, measured in ms, otherwise, measured in frames.
loop:boolean
Is sprite play in loop, default value is false.
onEnterFrame:Function
paused:boolean
Is sprite paused, default value is false.
timeBased:boolean
Is sprite animate base on time, default value is false (base on frame).

Constructor

Sprite(properties)
parameters
properties — Properties parameters for creating object, include all writable properties of this class, also include:
  • frames - Sprite animation frames data object.

Method Detail

addFrame(frame:Object, startIndex:Int):Sprite
parameters
frame:Object — Frames to add into.
startIndex:Int — The index to start adding frame, if is not given, add at the end of sprite.
return
Sprite — Sprite itself.
getFrame(indexOrName:Object):Object
parameters
indexOrName:Object — The index or name of the frame.
return
Object — The sprite object.
getFrameIndex(frameValue:Object):Object
parameters
frameValue:Object — Index or name of the frame.
return
Object — Sprite frame object.
getNumFrames():Uint
return
Uint — The total amount of frames.
goto(indexOrName:Object, pause:Boolean):Sprite
parameters
indexOrName:Object — Index or name of an frame to jump to.
pause:Boolean — Does pause after jumping to the new index.
return
Sprite — The Sprite object.
play():Sprite
return
Sprite — The Sprite object.
setFrame(frame:Object, index:Int):Sprite
parameters
frame:Object — The frame data to set on that index.
index:Int — Index of the frame to set.
return
Sprite — Sprite itself.
setFrameCallback(frame:Int|String, callback:Function):Sprite
parameters
frame:Int|String — Index or name of the assigned frame.
callback:Function — Callback function.
return
Sprite — The Sprite object.
stop():Sprite
return
Sprite — The Sprite object.