-
Notifications
You must be signed in to change notification settings - Fork 0
Working with Button
bapquad edited this page Feb 28, 2022
·
2 revisions
This content show you how to work with button in CaremJS.
You can set position of the image of button like as a sprite.
let btn = new Carem.Button(asset, 0, 0, 180, 30, scene);
btn.SetImagePositionY(-0);
The button has three event such that mouseUp
, mouseMove
, mouseDown
.
btn.onMouseUp(()=>this.mouseRelease());
With the mouseup
event, when the mouse button released, the event callback called.
btn.onMouseDown(()=>this.mouseDown());
With the mousedown
event, when the mouse button pressed, the event callback called.
btn.onMouseMove(()=>this.mouseMove());
With the mousemove event, when the mouse move over the button, the event callback called.