Jump to content

Problem using generated bitmapData for buttons


caragones
 Share

Recommended Posts

Hi!

 

I'm trying to create a bitmapData with some frames dinamically. 

 

To do that I make this:



mBMD = new Phaser.BitmapData(mGame, "BMD", width, height * frames);

// Draw the frames as spritesheet

mGame.cache.addBitmapData(mBMD.key, mBMD, Phaser.AnimationParser.spriteSheet(mGame, mBMD.texture, width, height, -1, 0, 0));


Then I create a button like this:

 



button.Panel = WidgetFactory.mGame.add.button(300, 300, WidgetFactory.mBMD, callback, callbackContext, 1, 0, 0, 0);


And all works fine.

 

But if I create another button in the same way:

 



button.Panel = WidgetFactory.mGame.add.button(300, 400, WidgetFactory.mBMD, callback, callbackContext, 1, 0, 0, 0);


When the mouse is over whatever button all the buttons change their frame.

 

What I'm doing wrong?

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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