(function() { var _this; var TestEntity = function() { _this = this; }; TestEntity.prototype = { preload: function(entityID) { _this.entityID = entityID; }, mousePressOnEntity: function(entityID, event) { print("Client script has received a mouse press: ", JSON.stringify(event)); if (event.isPrimaryButton) { Entities.callEntityServerMethod(_this.entityID, "mousePressed"); } } }; return new TestEntity(); });