I believe at some point even I answered this question on the forum, but the solution in the Corona documentation doesn’t seem to be working anymore. Every time the length of the text (e.g. a score) increases, the text gets offset to the right a little bit more.
Here’s what I’m doing:
I use this to declare the text:
distanceText = display.newText(UIGroup, "0 m", 0, 0, "Verdana-Bold", 15)
distanceText:setReferencePoint(display.cl); distanceText.x = 85; distanceText.y = 15; distanceText:setTextColor(255,255,255)
and this to update it:
distanceText.text = tostring(math.round(player:getDistance())).." m"
distanceText:setReferencePoint(display.cl); distanceText.x = 85; distanceText.y = 15
which is the correct way to do it, according to this:
http://developer.coronalabs.com/reference/index/objectsetreferencepoint
Any thoughts?
Note: display.cl is a short-cut for center-left from crawlspacelib. [import]uid: 36054 topic_id: 33947 reply_id: 333947[/import]
[import]uid: 36054 topic_id: 33947 reply_id: 135045[/import]