phaser-ui-comps icon indicating copy to clipboard operation
phaser-ui-comps copied to clipboard

Have got a "PhaserComps.ComponentClip is not a constructor" error

Open EOShippo opened this issue 5 years ago • 0 comments

I followed the setup and have got a error: Uncaught TypeError: PhaserComps.ComponentClip is not a constructor at initialize.create (project.bundle.js:1) at initialize.create (phaser.min.js:1) at initialize.loadComplete (phaser.min.js:1) at initialize.h.emit (phaser.min.js:1) at initialize.loadComplete (phaser.min.js:1) at initialize.fileProcessComplete (phaser.min.js:1) at initialize.onProcessComplete (phaser.min.js:1) at initialize.onProcess (phaser.min.js:1) at initialize.nextFile (phaser.min.js:1) at initialize.onLoad (phaser.min.js:1) And the index.js as follow:

const COMPONENT_CONFIG = "comp-config";
const TEXTURE_CONFIG = "my_texture";


var game = new Phaser.Game({
    type: Phaser.AUTO,
    parent: "phaser-example",
    width: 800,
    height: 600,
    scene: {
        preload: preload,
        create: create
    }
});


function preload() {
    this.load.json(COMPONENT_CONFIG, "assets/WindowTest.json");
    //this.load.multiatlas(TEXTURE_CONFIG, "assets/atlases/my_atlas.json", "assets/atlases/");
}

function create() {
    let clip = new PhaserComps.ComponentClip(
        this,
        this.cache.json.get(COMPONENT_CONFIG),
        [ TEXTURE_CONFIG ]
    );

    let component = new PhaserComps.UIComponents.UIComponentPrototype();
    component.appendClip(clip);
}

And if I just tested the phaser code,it worked just fine.

EOShippo avatar Jan 16 '20 04:01 EOShippo