camelot10 Posted December 17, 2014 Share Posted December 17, 2014 i got this error Phaser v2.2.1 | Pixi.js v2.2.0 | WebGL | WebAudio http://phaser.io ♥♥♥Tutorial.js:22 Phaser.SpriteTutorial.js:23 Uncaught TypeError: Cannot set property 'width' of undefinedTutorial.js:23 Phaser2048.Tutorial.createphaser.js:18686 Phaser.StateManager.loadCompletephaser.js:19383 Phaser.SignalBinding.executephaser.js:19206 Phaser.Signal.dispatchphaser.js:57772 Phaser.Loader.nextFilephaser.js:57722 Phaser.Loader.xmlLoadCompletephaser.js:57367 _xhr.onloadin this codePhaser2048.Tutorial = function(game){this.bgSpite = null;this.bgSpiteTop = null;};Phaser2048.Tutorial.prototype = {preload: function(){this.load.image('bg-bottom', 'images/bg.png');this.load.image('bg-top', 'images/bg-top.png');this.load.image('tile00', 'images/tile00.png');this.load.image('tile01', 'images/tile01.png');this.load.image('tile02', 'images/tile02.png');this.load.image('tile03', 'images/tile03.png');this.load.bitmapFont('main-font', 'fonts/bang_whack_pow.png', 'fonts/bang_whack_pow.fnt'); },create: function(){this.bgSpite = this.game.add.sprite(0, 0, 'bg-bottom');console.log(this.bgSpite);this.bgSprite.width = 500;// ERROR <<<< HERE <<<<<this.bgSprite.height = 500;///*this.bgSpite.inputEnabled = true;this.bgSpite.events.onInputDown.addOnce(this.nextTutorialPage, this);this.bgSpiteTop = this.add.image(0, 0, 'bg-top');this.bgSpiteTop.width = this.world.width;this.bgSpiteTop.height = this.world.height;//*/},nextTutorialPage: function(pointer){console.log('next tutorial page');}};picture is displayed, width and height not changed, console shows that sprite created but width is undefined can someone tell me what im doing wrong ? Link to comment Share on other sites More sharing options...
lewster32 Posted December 17, 2014 Share Posted December 17, 2014 It's just a typo, you've called it bgSpite and then tried to access it as bgSprite. Link to comment Share on other sites More sharing options...
Recommended Posts