Sign in to follow this  
tdnshah

Phaser PopUp Using Modal.js

Recommended Posts

I want to add popup to the game i am developing using Phaser.js. After searching a bit for the same i could found modal.js for this.

I am trying to integrate modal.js but am unable to get through. And I am getting an error "Uncaught TypeError: Cannot set property 'modal1' of undefined"  below is the part of my code which i am using to add the modals to my game. If any one can help me with this error please will be a great help.

Here is my code 

var reg={};

createModals: function(){
    reg.modal.createModal({
        type: "modal1",
        includeBackground: true,
        modalCloseOnInput: true,
        itemsArr: [{
            type: "graphics",
            graphicColor: "0xffffff",
            graphicWidth: 300,
            graphicHeight: 300,
            graphicRadius: 40
        }, {
            type: "text",
            content: "The white behind me\nis a [Phaser.Graphic]",
            fontFamily: "Luckiest Guy",
            fontSize: 22,
            color: "0x1e1e1e",
            offsetY: -50
        }, ]
    });
        
    },
    
    showModal1: function(){
    reg.modal.showModal("modal1");
    }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.