Jump to content

Importing classes not working


Recommended Posts

Hi all,

I'm very new to Phaser and I'm having a rough time importing a 3rd party class into my project. I'm trying to import the "phaser list view" class (link here https://github.com/mattcolman/phaser-list-view). I've added the appropriate script row into my index.html file. Then, in the state where I intend to use the list view, I can't seem to get it to import the list view without getting errors. I've tried starting my levelSelect.js state with the following:

import {ListView} from 'phaser-list-view';

From there I go on to define my levelSelect state. Of course, I've made sure to include the "phaser-list-view.js" file in my project path as well but I still get errors. I get a black screen when testing and the Chrome console throws the error "Uncaught SyntaxError: Unexpected token {         levelSelect.js: 1"

I literally haven't even tried to write any other code involving the "phaser-list-view" class yet - I'm just trying to get the import statement right. I've never tried to import a class so I'm not sure if I'm just using improper syntax or something... Can anyone point me in the right direction here?

EDIT: For what it's worth - I think this may have something to do with errors/issues with that class specifically. I just tried importing a different third-party plugin for scrolling and I don't get any of the same issues/errors when importing. Oh well - guess I'll just move forward with the other plugin. In case anyone else experiences this, the other plugin I'm using instead is called the Phaser Kinetic Scrolling Plugin.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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