Class: Sprite_Button

Sprite_Button

new Sprite_Button()

The sprite for displaying a button.

Extends

Members

The bitmap for the sprite

blendModenumberinherited

The blend mode to be applied to the sprite

heightnumberinherited

The height of the sprite without the scale

opacitynumberinheritedoverrides

The opacity of the sprite (0 to 255)

widthnumberinherited

The width of the sprite without the scale

Methods

blockHeight()number

Get the height of a block
Returns:
TypeDescription
numberThe block height

blockWidth()number

Get the width of a block
Returns:
TypeDescription
numberThe block width

buttonData()Object

Gets button data
Returns:
TypeDescription
ObjectAn object with button x and width data for the button type

checkBitmap()

Check if the bitmap is a valid MZ button bitmap

destroy()inherited

Destroys the sprite

getBlendColor()arrayinherited

Gets the blend color for the sprite
Returns:
TypeDescription
arrayThe blend color [r, g, b, a]

getColorTone()arrayinherited

Gets the color tone for the sprite
Returns:
TypeDescription
arrayThe color tone [r, g, b, gray]

hide()inherited

Makes the sprite "hidden" (not visible)

hitTest(x, y)booleaninherited

Check if the touch is within the sprite
NameTypeDescription
xnumberThe x coordinate of the touch
ynumberThe y coordinate of the touch
Returns:
TypeDescription
booleanTrue if the x and y coordinates are inside the sprite

initialize(bitmap)inheritedoverrides

Initializes the sprite
NameTypeDescription
bitmapBitmapThe bitmap of the sprite

isBeingTouched()booleaninherited

Check if the sprite is being touched
Returns:
TypeDescription
booleanTrue if the sprite is touched

isClickEnabled()booleaninherited

Check if the sprite is clickable
Returns:
TypeDescription
booleanTrue if the sprite is clickable

isPressed()booleaninherited

Check if the sprite is pressed
Returns:
TypeDescription
booleanTrue if the sprite is pressed

loadButtonImage()

Loads the button bitmap image

move(x, y)inherited

Sets the x and y coordiantes of the sprite
NameTypeDescription
xnumberThe x coordinate of the sprite
ynumberThe y coordinate of the sprite
Handling for when the sprite is clicked

onMouseEnter()inherited

Handling for when the mouse enters the sprite

onMouseExit()inherited

Handling for when the mouse exits the sprite

onPress()inherited

Handling for when the sprite is pressed

processTouch()inherited

Processing for touches

setBlendColor(color)inherited

Sets the blend color for the sprite
NameTypeDescription
colorarrayThe blend color [r, g, b, a]

setClickHandler(method)

Sets the handler to be called when the button is clicked
NameTypeDescription
methodfunctionThe function to call when clicked

setColdFrame()

Sets the button's cold frame (not pressed)

setColorTone(tone)inherited

Sets the color tone for the sprite
NameTypeDescription
tonearrayThe color tone [r, g, b, gray]

setFrame(x, y, width, height)inherited

Sets the rectagle of the bitmap that the sprite displays
NameTypeDescription
xnumberThe x coordinate of the frame
ynumberThe y coordinate of the frame
widthnumberThe width of the frame
heightnumberThe height of the frame

setHotFrame()

Sets the button's hot frame (pressed)

setHue(hue)inherited

Sets the hue rotation value
NameTypeDescription
huenumberThe hue value (-360, 360)

setupFrames()

Sets up the button's frames

show()inherited

Removes the "hidden" state of the sprite, making it visible
Updates the sprite for each frame

updateFrame()

Update the button's frame

updateOpacity()

Update the button's opacity

updateVisibility()inherited

Updates the visibility status of the sprite