easeljs - Button CreateJs -
can me. can´t make button work... used similar before. call gamemenu scene inside js.
var scene = new game.gamemenu(); scene.on(game.gamestateevents.game, this.onstateevent, this, true, {state:game.gamestates.game}); stage.addchild(scene);
the button here inside code:
(function (window) { window.game = window.game || {} function gamemenu() { this.initialize(); } var p = gamemenu.prototype = new createjs.container(); p.btniniciar; p.container_initialize = p.initialize; p.initialize = function () { this.container_initialize(); this.addtitle(); this.addbutton(); } p.addtitle = function () { var titulo = new createjs.sprite(spritesheet, 'titulo'); titulo.x = screen_width / 2 - titulo.getbounds().width/2; titulo.y = screen_height / 2 - titulo.getbounds().height/2; this.addchild(titulo); } p.addbutton = function() { this.btniniciar = new createjs.sprite(spritesheet, 'btniniciar'); this.btniniciar.mouseenabled = true; this.btniniciar.cursor = 'pointer'; this.btniniciar.x = screen_width / 2 - this.btniniciar.getbounds().width/2; this.btniniciar.y = (screen_height / 2 - this.btniniciar.getbounds().height/2) + 200; stage.addchild(this.btniniciar); this.btniniciar.addeventlistener("click", function(event) { console.log("click not working"); }); } window.game.gamemenu = gamemenu; }(window));
Comments
Post a Comment