Class: GUI_Object

me. GUI_Object

new GUI_Object(x, y, settings)

GUI Object
A very basic object to manage GUI elements
The object simply register on the "pointerdown"
or "touchstart" event and call the onClick function"
Parameters:
Name Type Description
x Number the x coordinate of the GUI Object
y Number the y coordinate of the GUI Object
settings Object See me.Entity
Source:
GUI.js, line 52
Example
// create a basic GUI Object
var myButton = me.GUI_Object.extend(
{
   init:function (x, y)
   {
      var settings = {}
      settings.image = "button";
      settings.framewidth = 100;
      settings.frameheight = 50;
      // super constructor
      this._super(me.GUI_Object, "init", [x, y, settings]);
      // define the object z order
      this.pos.z = 4;
   },

   // output something in the console
   // when the object is clicked
   onClick:function (event)
   {
      console.log("clicked!");
      // don't propagate the event
      return false;
   }
});

// add the object at pos (10,10)
me.game.world.addChild(new myButton(10,10));

Extends

Members

animationpause :Boolean

pause and resume animation
default value : false;
Type:
  • Boolean
Inherited From:
Source:
sprite.js, line 37

animationspeed :Number

animation cycling speed (delay between frame in ms)
default value : 100ms;
Type:
  • Number
Inherited From:
Source:
sprite.js, line 46

holdThreshold :number

Tap and hold threshold timeout in ms
Type:
  • number
Default Value:
  • 250
Source:
GUI.js, line 68

hover :boolean

true if the pointer is over the object
Type:
  • boolean
Default Value:
  • false
Source:
GUI.js, line 85

isClickable :boolean

object can be clicked or not
Type:
  • boolean
Default Value:
  • true
Source:
GUI.js, line 59

isHoldable :boolean

object can be tap and hold
Type:
  • boolean
Default Value:
  • false
Source:
GUI.js, line 76

Methods

<static> onClick(event)

function called when the object is pressed
to be extended
return false if we need to stop propagating the event
Parameters:
Name Type Description
event Event the event object
Source:
GUI.js, line 141

<static> onHold()

function called when the object is pressed and held
to be extended
Source:
GUI.js, line 231

<static> onOut(event)

function called when the pointer is leaving the object area
Parameters:
Name Type Description
event Event the event object
Source:
GUI.js, line 184

<static> onOver(event)

function called when the pointer is over the object
Parameters:
Name Type Description
event Event the event object
Source:
GUI.js, line 164

<static> onRelease(event)

function called when the object is pressed and released
to be extended
return false if we need to stop propagating the event
Parameters:
Name Type Description
event Event the event object
Source:
GUI.js, line 206
Copyright © 2011 - 2016, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-01-16T10:03:05+08:00 using the DocStrap template modified by codename-.