You don’t have to, but the effect of your text change can be a bit unpredictable, particularly if you’re also moving the text object onscreen. If you always want text in the same position and alignment, you’d probably want to just write a function like this:
[code] – function
local function setText(self, string)
self.text = string or self.text
self:setReferencePoint(display.TopLeftReferencePoint)
self.x = self.originalX or self.x
self.y = self.originalY or self.y
end
– make the text object
local object = display.newText(“Hi there!”)
object:setReferencePoint(display.TopLeftReferencePoint)
object.x = 32
object.y = 48
object.originalX = object.x
object.originalY = object.y
object.setText = setText
– how to use:
object:setText(“Wait a minute!”) – whatever string you use with this is always TL aligned and using originalX/originalY as alignment[/code] [import]uid: 41884 topic_id: 35354 reply_id: 140544[/import]