5

As a little problem , I got the solution ! But why it did like that ?

var label = new Text(text.toString(), "20px Arial", "orange");
label.textAlign = "center";
label.x = 708;
label.y = 435;
label.maxWidth=40;
stage.addChild(label);

Firstly,I did not add the label.maxWidth=40 . And something amazing happing , it works in firefox and chrome on Ubuntu ! Nevertheless , it displayed nothing in chrome on windows.

Attach the declaration of maxWidth from official website http://easeljs.com/docs/Text.html

maxWidth - Number The maximum width to draw the text. If maxWidth is specified (not null), the text will be condensed or shrunk to make it fit in this width.

Lanny
  • 11,244
  • 1
  • 22
  • 30
Jayce Lin
  • 447
  • 1
  • 6
  • 10

1 Answers1

6

This is bug introduced in Chrome version 17 where the maxWidth does not default properly. It has been fixed in version 18. Affects windows and mac versions of Chrome.

Lanny
  • 11,244
  • 1
  • 22
  • 30