Commit 719b4bb
committed
Alter BitmapText to use toString on text parameter in constructor
The BitmapText property accessor for the text property uses toString on the value passed in, meaning Numbers can be passed in as the text value with no problem. However, passing a Number into the constructor results in the following exception as it isn't implicitly converted to a string in a similar manner.
phaser.js:71890 TypeError: text.substr is not a function
at Phaser.BitmapText.updateText (http://localhost/phaser/build/phaser.js:56283:21)
at new Phaser.BitmapText (http://localhost/phaser/build/phaser.js:56034:10)
at Phaser.GameObjectFactory.bitmapText (http://localhost/phaser/build/phaser.js:46318:26)
at Object.Boot.create (http://localhost/phaser/:46:34)
at Phaser.StateManager.loadComplete (http://localhost/phaser/build/phaser.js:29240:35)
at Phaser.Loader.finishedLoading (http://localhost/phaser/build/phaser.js:71446:25)
at Phaser.Loader.processLoadQueue (http://localhost/phaser/build/phaser.js:71403:18)
at Phaser.Loader.asyncComplete (http://localhost/phaser/build/phaser.js:71476:14)
at Phaser.Loader.xmlLoadComplete (http://localhost/phaser/build/phaser.js:72413:14)
at .<anonymous> (http://localhost/phaser/build/phaser.js:72236:34)
This simply mimics the logic in the property accessor by running toString on the text value and using an empty string if null to allow Numbers to be passed into the constructor.1 parent 358cc6b commit 719b4bb
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
0 commit comments