Phaser API Documentation

  Version: 
setMaxWidth(value, [wordWrapCharCode])

Description:

Sets the maximum display width of this BitmapText in pixels.

If BitmapText.text is longer than maxWidth then the lines will be automatically wrapped based on the previous whitespace character found in the line.

If no whitespace was found then no wrapping will take place and consequently the maxWidth value will not be honored.

Disable maxWidth by setting the value to 0.

You can set the whitespace character to be searched for by setting the wordWrapCharCode parameter or property.

Parameters:

name type arguments description
value number

The maximum display width of this BitmapText in pixels. Set to zero to disable.

wordWrapCharCode number <optional>

The character code to check for when word wrapping. Defaults to 32 (the space character).

Returns:
Description:

This BitmapText Object.