Moscrif API Docs for: 2012q3
Show:

GameButton Class

Extends ImageButton
include "lib://game2d/gameButton.ms";
Library: game2d

This class is deprecated.

Implements game button functionality. This class is obsolete, please use ImageButton or TextButton.

Methods

_drawImage

(
  • canvas
)
private

Inherited from ImageButton

Draw Image mode, display image based on button state

Parameters:

  • canvas Canvas

    Canvas used to draw sequence

_drawSequence

(
  • canvas
)
private

Inherited from ImageButton

Method do draw sequence mode, display frame based on button state.

Parameters:

  • canvas Canvas

    Canvas used to draw sequence

aftetInit

() protected

Inherited from ImageButton

Init button. This method is called from class constructor and it is usually no needed to change it.

draw

(
  • canvas
)
protected

Inherited from ImageButton

Draw method draws the button.

Parameters:

  • canvas Canvas

    Current game canvas

init

()

Inherited from ImageButton

Draw warning message

Properties

frame

Integer

Inherited from ImageButton:

Get frame index first frame has index 0 then 1, 2 ...

frameHeight

Integer

Inherited from ImageButton:

Set frame height. Button's image is automatically divided into frames acording to frame width and height.

Example:

var button = new ImageButton ({
    image       : res.img.continueButton,
    x           : System.width/2,
    y           : top,
    frameWidth  : res.img.continueButton.width,
    frameHeight : res.img.continueButton.height / 2,
});

frameWidth

Integer

Inherited from ImageButton:

Set frame width. Button's image is automatically divided into frames acording to frame width and height.

Example:

var button = new ImageButton ({
    image       : res.img.continueButton,
    x           : System.width/2,
    y           : top,
    frameWidth  : res.img.continueButton.width,
    frameHeight : res.img.continueButton.height / 2,
});

image

Bitmap | String

Inherited from ImageButton:

Image on the button. If image contains two frames, first frame is used for normal state and second for pressed state.

Example:

var button = new ImageButton ({
    image       : res.img.continueButton,
    x           : System.width/2,
    y           : top,
    frameWidth  : res.img.continueButton.width,
    frameHeight : res.img.continueButton.height / 2,
});

imagePressed

Bitmap | String

Inherited from ImageButton:

Image on pressed button, displays image when user click on the button. The pressed image can be palced also in one file with normal image.

Example:

var button = new ImageButton ({
    image           : res.img.continueButton,
    imagePressed    : res.img.continueButtonPressed,
    x               : System.width/2,
    y               : top,
});

mode

Symbol

Inherited from ImageButton:

Displaying game button mode: 1. #sequence, this mode calculate based frameWidth or frameHight, segiences and frames Maximum allowed frames for game button is Two 2. #image, game button expect two images. One for normal state second one for pressed state. If pressedImage is not set by default is set to the image

scaledHeight

Integer

Inherited from ImageButton:

Get scaled height of this object

scaledWidth

Integer

Inherited from ImageButton:

Get scaled width of this object

sequence

Array

Inherited from ImageButton:

This property sets sequence of the button frames.