SDK Documentation & Reference.Documentation Pdf



NKButton


Overview

Creates native Cocoa Touch button. Control is created on the top layer of page, so if there are html elements on given coordinates control will overlap them.

init(x, y, width, height, callback)

Initializes button
Parameters:
x - left coordinate of the control
y - top coordinate of the control
width - horizontal size of the control
height - vertical size of the control
callback - javascript function to be called when slider changes value. This callback has one parameter - controlID, which is an ID of the control, in case you have one callback for many controls.

show()

shows initialized button, does nothing if it's shown already

hide()

hides initialized button, does nothing if it's hidden already

setImage(imageName)

sets the image to be displayed over the button, images are not scaled and appear in real size.

setTitleColor(r, g, b)

sets the color of the button title, specified in r, g, b, as color components of red, green and blue. Parameters can take values in range [0..255].

setTitle(title)

sets the title to be displayed over the button

Example:

function playRadio()
{
  var radio = new NKInternetPlayer();
  radio.playFromURL("http://myradio.com:8000");
}
var playButton = new NKButton();
playButton.init(15, 390, 60, 20, "playRadio");
playButton.setImage("play.png");
playButton.show();