API
Events
Application can receive events from the device to which it can respond and achieve interaction with the user.
onKeyDownEvent (e)
Function is executed every time key is pressed.
e.keyCode contains code of the pressed key.
onKeyUpEvent (e)
Function is executed every time key is released.
e.keyCode contains code of the released key.
onTouchEvent (e)
Function is executed when the touch-screen is pressed (touched).
e.x contains X coordinate of the touched point.
e.y contains Y coordinate of the touched point.
onUntouchEvent (e)
Function is executed when the touch-screen is depressed.
e.x contains X coordinate of the release point.
e.y contains Y coordinate of the release point.
onDragEvent (e)
Function is executed when the item on the screen is "dragged".
e.x contains X coordinate of the currently pressed point.
e.y contains Y coordinate of the currently pressed point.
onLocationUpdateEvent (e)
Function is executed when the location of the device is updated.
e.longitude contains longitude of the current position.
e.latitude contains latitude of the current position.
e.speed contains speed of the movement.
onShakeEvent (e)
Function is executed when the device is shaken.
e.intensity contains intensity of the shake movement.
Storage
Storage object allows saving and loading data in local storage on the device. Data can be strings, numbers and logical values. Every data is identified and accessed using its unique key.
bool keyExists (key)
Function returns true if the key exists.
string readString (key)
Function reads string value identified by the key.
writeString (key, value)
Function writes string value for the given key.
number readNumber (key)
Function reads number value identified by the key.
writeNumber (key, value)
Function writes number value for the given key.
bool readBool (key)
Function reads logical value identified by the key.
writeBool (key, value)
Function writes logical value for the given key.
Net
Net object allows applications to connect to internet services.
openHtml (html)
Function opens browser screen with HTML code sent in textual parameter.
openUrl (url)
Function opens browser screen with web page on given address (URL).
Location
Location object provides access to positioning (GPS) data of the device. Longitude and latitude can be displayed and used inside application, as well as online location-based services.
startTracking ()
Function starts location tracking.
stopTracking ()
Function stops location tracking. It is recommended to stop tracking when not needed in order to improve battery life.
number getLongitude ()
Function returns last recorded longitude, or NaN if longitude was undefined.
number getLatitude ()
Function returns last recorded latitude, ili NaN if latitude was undefined.
Sensor
Sensor object provides access to sensors of the device: orientation and acceleration. Reading these sensors allows making applications such as compass.
startTracking ()
Function starts sensor reading.
stopTracking ()
Function stops sensor reading. It is recommended to stop reading when not needed in order to improve battery life.
number getOrientationAzimuth ()
Function reads azimuth, the angle between magnetic north and Y-axis of the device. Values range from 0 to 359 degrees, where 0=north, 90=east, 180=south, 270=west, or NaN if azimuth value is undefined.
number getOrientationPitch ()
Function reads rotation around X-axis. Values range from -180 to 180 degrees, or NaN if rotation value is undefined.
number getOrientationRoll ()
Function reads rotation around Y-axis. Values range from -90 do 90 degrees, or NaN if rotation value is undefined.
number getAccelerationX ()
Function reads acceleration by X-axis, or NaN if value is not defined.
number getAccelerationY ()
Function reads acceleration by Y-axis, or NaN if value is not defined.
number getAccelerationZ ()
Function reads acceleration by Z-axis, or NaN if value is not defined.
Console
Console object represents textual console. It is used for applications running in console display mode, using textual input and output.
write (text)
Function writes the text inside console.
writeLine (text)
Function writes text inside console and goes into new line.
string read (message)
Function opens dialog for text entry and reads string, with optional message shown to the user.
Function returns entered text, or null if entry was canceled.
cls ()
Function clears console text.
msgBox (title, message, modal)
Function shows dialog message box on the screen. Dialog may be modal, that stops application work until it is closed.
setBackColor (red, green, blue)
Function sets background color of the console. Parameters are color components with values from 0 to 255.
setTextColor (red, green, blue)
Function sets color of the console text. Parameters are color components with values from 0 to 255.
Display
Display object represents screen of the mobile device. Applications which work in graphics display mode use these functions to draw shapes, text and other visual objects.
drawCircle (x, y, radius)
Function draws a circle with center at given coordinates.
repaint ()
Function refreshes display on the screen. Drawing operations do not need to be immidiately visible, so the screen may have to be explicitely refreshed using this function.
setColor (red, green, blue)
Function sets current drawing color. Parameters are color components with values from 0 to 255.
number getWidth ()
Function returns screen width in pixels.
number getHeight ()
Function returns screen height in pixels.
drawLine (x1, y1, x2, y2)
Function draws a line between two points on the screen, using current drawing color.
drawRect (x, y, width, height)
Function draws a rectangle with given top-left corner point, width and height in pixels, using current drawing color.
fillRect (x, y, width, height)
Function draws a filled rectangle with given top-left corner point, width and height in pixels, using current drawing color.
drawText (x, y, text)
Function draws text on the screen at given coordinates, using current drawing color.
number getTextWidth (text)
Function returns width of the text in pixels.
number getTextHeight (text)
Function returns height of the text in pixels.
setPixel (x, y)
Function sets pixel at given coordinates, using current drawing color.
fillCircle (x, y, radius)
Function draws a filled circle with center at given coordinates, using current drawing color.
Turtle
Turtle objects implements so called turtle graphics. Application must work in graphics display mode to show turtle graphics results.
move (distance)
Function moves cursor from current position for given distance in pixels, using current direction and speed.
moveTo (x, y)
Function moves cursor from current position to given coordinates.
hide ()
Function hides cursor.
show ()
Function shows cursor.
penDown ()
Function "lowers" cursor, which enables leaving the trail (i.e. drawing) using move and moveTo functions.
penUp ()
Function "raises" cursor, which disables leaving the trail (i.e. drawing) using move and moveTo functions.
turn (angle)
Function rotates cursor clockwise, for given angle in degrees.
turnLeft ()
Function rotates cursor to the left, 90 degrees anti-clockwise.
turnRight ()
Function rotates cursor to the right, 90 degrees clockwise.
number getX ()
Function reads current X coordinate of the cursor.
setX (value)
Function moves cursor to X coordinate.
number getY ()
Function reads current Y coordinate of the cursor.
setY (value)
Function moves cursor to Y coordinate.
number getAngle ()
Function reads cursor orientation (movement angle), in clockwise direction.
setAngle (value)
Function sets cursor orientation (movement angle), in clockwise direction. Values range from 0 to 359 degrees.
number getSpeed ()
Function returns current cursor movement speed.
setSpeed (value)
Function sets cursor movement speed. Values range from 1 (slowest) to 9 (fastest).
center ()
Function moves cursor to the center of the screen.
