GameButton : GameControl
Example
var menu = new Scene(); this.push(menu); var btnPlay = new GameButton({image : "app://play_btn.png", x : System.width / 2, y : System.height / 4}); btnPlay.onClick = function() { console<<"user clicked on the play button\n"; } menu.add(btnPlay);
Properties
-
defaults : Object
Sets default controls options.
-
frame : Integer
Get frame index.
-
frameHeight : Integer
Set frame height.
-
frameWidth : Integer
Set frame width.
-
height : Integer
Height of this object
-
image : Bitmap
Game object image.
-
name : String
Name of the game object.
-
options : Object
Position of navigation bar.
-
paint : Paint
Object used for final decoration.
-
scale : Float
Scale of the game object.
-
scaledHeight : Integer
Get scaled height of this object.
-
scaledWidth : Integer
Get scaled width of this object.
-
sequence : Array
Sequence of the frames.
-
this(options = {})
Construct of the object calls following method in order.
-
visible : Boolean
Visibility of game object. Default is set to visibility true.
-
width : Integer
Width of this object
-
x : Integer
X - coordinates of view's position.
-
y : Integer
Y - coordinates of view's position.
Methods
-
_initObject()
Function to set object's parameters, this function is called within draw for the forst time, or if object was changed.
-
_setObject()
Object parameters if object has been changed.
-
afterInit
Method is executed after inititialization of this object
-
beforeInit
Method is executed before inititialiation of this object
-
draw(canvas,paint = null)
Method to defines what is done if onDraw event is called.
-
init() : GameControl
Init Game control instance.
-
intersectsBounds(obj) : Boolean
Check intersects by object.
-
intersectsPoint(x, y) : Boolean
Check intersects by Location(x and y coordinate).
-
nextFrame(rewind = true)
Get next Frame.
-
prevFrame(rewind = true)
Get previous frame.
-
process()
Call on process handler if defined.
-
setDefaults
Method is setting default class values.
-
setOptions
Method is setting options passed as class parameters.
-
undefined(k,v)
Sspecial property executed when priperty is undefined. It can be that JSON format is in format "key" : "value".
Events
-
onClick(sender) : Function
Event fired, within pointer pressed event.
-
onProcess(sender) : Function
Event on process handler. It defines what suppose to be done on game process.