Text Alignment Problem

Hi,

I couldn’t find another topic about the problem I experience, so probably there is something I miss.

Problem is that while I give both width and height for my text object, I can’t change it’s alignment. It’s always “left” on me. Exact code that doesn’t work on me is like that;

lAddition = display.newText("Addition", mainX + 20, mainY - 90, 250, 26, mainFont, 26) lAddition:setFillColor(1, 1, 1) lAddition.align = "right" sceneGroup:insert(lAddition)

What may cause this problem?

Hi @Kraeius,

For non-standard (left) alignment, you should declare the alignment when you create the text object, not afterward. Please follow the syntax in the documentation (the first Syntax section, not the “Legacy Syntax”):

https://docs.coronalabs.com/api/library/display/newText.html

Best regards,

Brent

Thanks Brent, problem solved with your help :slight_smile:

Hi @Kraeius,

For non-standard (left) alignment, you should declare the alignment when you create the text object, not afterward. Please follow the syntax in the documentation (the first Syntax section, not the “Legacy Syntax”):

https://docs.coronalabs.com/api/library/display/newText.html

Best regards,

Brent

Thanks Brent, problem solved with your help :slight_smile: