-
Notifications
You must be signed in to change notification settings - Fork 21
Button Element Interface
The Button Element is a multi-state button with a single integer value that ranges from 0 to n, where n is the number of the button states. A Button can be controlled by the user clicking on it. A series of ordered images (frames) is used to display the various Button states. When it is clicked, the Button's state advances by one and the image at the corresponding index is displayed. When the Button's state reaches the maximum state, it wraps back to state #0.
The Button interface is defined in Button.js.
Button.prototype.getready = function (args) // {Object}
Other than the Graphical Element Interface constructor parameters, Button has some unique parameters:
-
imagesArray {Array}
: An array of images, ordered from the frame associated with the lowest value (0) to the frame associated with the highest.
-
values.buttonvalue {Int}
: The buttonvalue of a Button reflects its internal state. -
defaultSlot {String = 'buttonvalue'}
: The default slot of a knob is its only slot, called 'buttonvalue'.
Button.prototype.setStatesNumber = function (number) // {Int}
Button.prototype.getStatesNumber = function ()
These methods set and get dinamically the number of the Button's states. When a Button is constructed, the number of its states is the number of images in the array, or imagesArray.length
.
The Button's maximum number of states can be re-set at any time by setStatesNumber()
(this won't automatically change the buttonvalue
if it is out of the range, so a prior check is required).