i want to create a DOM Popup Box with one Button which lets the whole box disappear when clicked.
I can’t find an example of how the button has to look like that it can be used from inside the game to do that.
i want to create a DOM Popup Box with one Button which lets the whole box disappear when clicked.
I can’t find an example of how the button has to look like that it can be used from inside the game to do that.
right now the dom in the .js i looking like this:
var element = this.add.dom(400, 300).createFromCache('smalldiv');
element.addListener('click');
element.on('click', function (event) {
if (event.target.name === 'clickMe')
{
// Turn off the click events
this.removeListener('click');
element.setVisible(false);
text.setText('Welcome ');
}
// Populate the text with whatever they typed in as the username!
});
}
the button in the html looks like this:
<p class="nomargin"> <button id="clickMe">
Button1
</button></p>
Use if (event.target.id === 'clickMe')
.