How to turn this text format into Phaser CE text style?

I have this ActionScript 3 TextFormat settings:

textFormat = new TextFormat();
textFormat.size = 15;
textFormat.font = "Arial";
textFormat.color = 0x000000;
textFormat.align = TextFormatAlign.CENTER;

buttonText = new TextField();
buttonText.selectable = false;
buttonText.defaultTextFormat = textFormat;
buttonText.mouseEnabled = false;
buttonText.tabEnabled = false;
buttonText.x = 2;
buttonText.y = 2;
buttonText.width = 65;
buttonText.height = 25;
buttonText.text = btnText;
btnRect.addChild(buttonText);

I tried this as per this page Phaser.Text:

textStyleBasicButton = {
	font: 'normal 15pt Arial', 
	align: 'center', 
	fontStyle: 'normal', 
	fontSize: 15,
	fontWeight: 'normal',
	fill: '#000000',
	tabs: 0,
	testString: 'should be 65px wide and 25px high'
};

But I am not sure about the test string and about tabs. Is it ok?
Also it would become selectable only if inputEnabled is set to true?

What does it look like in ActionScript?

const textStyleBasicButton = {
    font: '15pt Arial',
    fill: '#000000',
    boundsAlignH: 'center',
    boundsAlignV: 'middle'
};

const button = this.add.text(2, 2, 'Hello world', textStyleBasicButton);

button.setTextBounds(0, 0, 65, 25);

Phaser CE has no selectable text. Input would be the usual events (pointer up, pointer down, etc.).

1 Like