Jump to content

Change the frame of a button on mouse out


Recommended Posts

Hello !


I'm working on a micro game that can be tested on this page : http://le-carre-noir.net/click-the-black-squares-beta/


On a mouse-in on my button GO, the frame is changed, so it goes green... But it doesn't go back white on mouse-out...


Here is my code :

this.button = this.game.add.button(this.game.world.centerX, 525, 'startBtn', this.actionOnClickStartButton, this, 1, 0, 0);

Here is the git repository : https://github.com/robomatix/click-the-black-squares


My code is the line 33 of game/states/menu.js


Can someone please help me to do a rollover effect as on the web...

Link to comment
Share on other sites

I've found an interssting example here : http://updownleftright.net/phaser/bugs/button/ ( https://github.com/photonstorm/phaser/issues/154 ) wich works ( the first button ).


I copied the code and use it with phaser 2.0.6 : http://le-carre-noir.net/tests/mouseinmouseout/

var game = new Phaser.Game(175, 100, Phaser.CANVAS, null, {    preload : function() {        game.load.spritesheet('button', 'button.png', 50, 50);    },    create : function(game) {        game.add.button(25, 25, 'button', function(self) { }, this,1,0,2);    }});

It dosen't work...


Do you think that might be a bug ?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...