Trouble Aligning Text

Hi all,

I’m trying to position this “continue…” text in the bottom-right of the screen and I can’t get it to work.  Text doesn’t move regardless of the align value.  I’ve read Rob’s text positioning tutorial (https://coronalabs.com/blog/2014/02/11/tutorial-methods-for-positioning-text/) multiple times but I’m still missing something.

I need to have it right-aligned because translated text will likely lead to longer strings.

 --Setup Text options local textColor = {0.72, 0.9, 0.16, 1} local textOptions = { text = "", font = native.newFont("FSEX300.ttf"), fontSize = 40, x = xStart, y = yStart, width = 950, height = 0, align = "left" } --Draws continue button in bottom-right of terminal screen function DrawContinueButton() print ("Drawing Continue..") textOptions.text = "Press any key to continue..."; local continueLabel = display.newText(textOptions) continueLabel.anchorX = 0; continueLabel.anchorY = 0; --Setting this in textOptions wasn't working for some reason continueLabel.width = display.viewableContentWidth; continueLabel.align = "right"; continueLabel.x = display.contentCenterX/2 continueLabel.y = maxLinePosY + 110 continueLabel:setFillColor(unpack(textColor)); --Green continueLabel:toBack(); end

Thanks in advance!

Dave.

Don’t you have to have the align setting set to “right” in ‘textOptions’ before calling display.newText?

Otherwise it creates the text and then you’re trying to re-align it by setting .align = “right”, which isn’t a thing.

Then you also seem to reset any alignment by setting anchorX to 0. For right alignment, you’d use anchorX = 1.

Setting alignment in textOptions and changing anchorX to 1 worked perfect.  Thanks!

Don’t you have to have the align setting set to “right” in ‘textOptions’ before calling display.newText?

Otherwise it creates the text and then you’re trying to re-align it by setting .align = “right”, which isn’t a thing.

Then you also seem to reset any alignment by setting anchorX to 0. For right alignment, you’d use anchorX = 1.

Setting alignment in textOptions and changing anchorX to 1 worked perfect.  Thanks!