JS v3.1: LabelTTF vertical text align is always centered

I am trying to create a label with top vertical alignment. Meaning the first line of the label is always at the same y position, and the text expands downward. The horizontal alignment works, but the middle of the text label is always at the same y position regardless of number of lines.

var label = cc.LabelTTF.create(msg, 'Arial', 32, cc.TEXT_ALIGNMENT_LEFT, cc.VERTICAL_TEXT_ALIGNMENT_TOP);

I also tried leaving the alignments undefined in the constructor and setting the alignment either before or after setting the position of the label:

label.setHorizontalAlignment(hAlign);
label.setVerticalAlignment(vAlign);
label.x = pos.x;
label.y = pos.y;

and

label.x = pos.x;
label.y = pos.y;
label.setHorizontalAlignment(hAlign);
label.setVerticalAlignment(vAlign);

But the text is always vertically centered.

As i understand - you want to place text top in vertical alignment and middle in horizontal alignment.

Try do this like i do:

var timeLabel = new cc.LabelTTF(’’, ‘Arial’, 30);
timeLabel.attr({
x: cc.winSize.width / 2,
y: RESOLUTION.height - 20, /max height - top margin/
anchorY: 0
});
this.addChild(timeLabel, 1);

As i know “create” method is deprecated in JS v3.0+, maybe this make wrong behavior.