API Document Index



Class me.GUI_Object


Extends me.SpriteObject.

Defined in: <build/melonJS-0.9.3.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
GUI Object
A very basic object to manage GUI elements
The object simply register on the "mousedown"
or "touchstart" event and call the onClicked function"
Field Summary
Field Attributes Field Name and Description
 
object can be clicked or not
Fields borrowed from class me.SpriteObject:
autodestroy, visible
Fields borrowed from class me.Rect:
bottom, height, left, pos, right, top, width
Method Summary
Method Attributes Method Name and Description
 
function called when the object is clicked
to be extended
return true if we need to stop propagating the event
 
OnDestroy notification function
Called by engine before deleting the object
be sure to call the parent function if overwritten
Methods borrowed from class me.SpriteObject:
draw, flicker, flipX, flipY, isFlickering, resize, setTransparency, update
Methods borrowed from class me.Rect:
contains, containsPoint, getRect, overlaps, set, union, within
Class Detail
me.GUI_Object()
GUI Object
A very basic object to manage GUI elements
The object simply register on the "mousedown"
or "touchstart" event and call the onClicked function"
// create a basic GUI Object
var myButton = me.GUI_Object.extend(
{	
   init:function(x, y)
   {
      settings = {}
      settings.image = "button";
      settings.spritewidth = 100;
      settings.spriteheight = 50;
      // parent constructor
      this.parent(x, y, settings);
   },
	
   // output something in the console
   // when the object is clicked
   onClicked:function()
   {
      console.log("clicked!");
      // don't propagate the event
      return true;
   }
});

// add the object at pos (10,10), z index 4
me.game.add((new myButton(10,10)),4);
Field Detail
{boolean} isClickable
object can be clicked or not
Method Detail
onClicked()
function called when the object is clicked
to be extended
return true if we need to stop propagating the event

onDestroyEvent()
OnDestroy notification function
Called by engine before deleting the object
be sure to call the parent function if overwritten

Documentation generated by JsDoc Toolkit 2.4.0 on Tue May 01 2012 12:00:49 GMT+0800 (CST)