# How to make a close button for menu

**URL:** <https://phaser.discourse.group/t/how-to-make-a-close-button-for-menu/1748>\
**Category:** Phaser 3\
**Created:** [March 19, 2019, 9:13pm UTC](https://phaser.discourse.group/t/how-to-make-a-close-button-for-menu/1748 "2019-03-19T21:13:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChetD90](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@ChetD90](https://phaser.discourse.group/u/ChetD90)\
**Post date:** [March 19, 2019, 9:13pm UTC](https://phaser.discourse.group/t/how-to-make-a-close-button-for-menu/1748/1 "2019-03-19T21:13:55Z")

</div>

I recently made a pop-up menu for my game which pops up after pushing a button. The problem is now that the buttons are not very interactive and every time I take the backbutton function outside keyboard event the game freezes. Then I error that states that backbutton is undefined. Here is the code:

```
this.input.keyboard.once("keydown_D", event => {
	var StoreWindow = this.add.image(0, 0, 'StoreWindow').setOrigin(0);
    var backbutton = this.add.image(32, 34, 'backbutton', 0).setOrigin(0).setInteractive();
    var testButton = this.add.image(64, 110, 'testButton', 0).setOrigin(0).setInteractive();

    var storeContainer = this.add.container(32, 70, [StoreWindow, backbutton, testButton]);

    storeContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, StoreWindow.width, StoreWindow.height), Phaser.Geom.Rectangle.Contains);

    this.input.setDraggable(storeContainer);

    storeContainer.on('drag', function (pointer, dragX, dragY) {

        this.x = dragX;
        this.y = dragY;

    backbutton.on('pointerup', function () {

       this.storeContainer.destroy();

    }, this);

      
 })
.setScrollFactor(0)
.setDepth(30);
```
