Closed sky-is-winning closed 3 years ago
You might try to load pluigin in preload stage, like this demo, line 13
Using the exact code from that demo, I get the same thing.
function preload() {
this.load.pack("pack", "assets/asset-pack.json");
this.load.plugin('rexinputtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinputtextplugin.min.js', true);
}
No idea sorry, I could not reproduce this issue in my environment. Could you list more detail about browser and provide a runnable code?
I'm using Microsoft Edge (Chromium) And here's the code
<!DOCTYPE html>
<html>
<head>
<script src="/lib/phaser.js"></script>
</head>
<body>
<script>
var config = {
type: Phaser.AUTO,
dom: {
createContainer: true
},
width: 1520,
height: 960,
scene: {
preload: preload,
create: create,
}
};
var game = new Phaser.Game(config);
function preload() {
this.load.pack("pack", "assets/asset-pack.json");
this.load.plugin('rexinputtextplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexinputtextplugin.min.js', true);
}
function create() {
this.add.image(760, 480, "main-bg");
var loading = this.add.sprite(760, 480, 'loading');
loading.play("loading")
}
</script>
</body>
</html>
Okay, weirdly I've now stopped getting that error (with the exact same code) but now when I try to put input text on the screen with
var inputText = this.add.rexInputText(760, 480, 100, 20, {
type: 'textarea',
text: 'hello world',
fontSize: '12px',
background: '#ffffff'
})
absolutely nothing happens
Please check 'parent' parameter, (that demo, line 53), that value will equal to the div of phaser3 game engine. See the 'HTML' part of that demo.
Rex Input Text Plugin is installed like this
<script type="text/javascript" src="assets/components/rexinputtextplugin.min.js"></script>
But when trying to load my game, I get hit with 'Super expression must either be null or a function' This doesn't happen when the plugin is disabled I'm not trying to load anything with the plugin, just it being loaded is causing this.