When I create a text object and then set the reference point to CenterLeftReferencePoint, when I later change the text of the text object the text object’s reference reverts to CenterReference Point. Resetting the reference point and location work, but shouldn’t be necessary.
txt = display.newText("test",0,0,nil,48);
txt:setReferencePoint(display.CenterLeftReferencePoint);
txt.x = display.contentWidth \* 0.5; txt.y = 100;
function txt:touch(e)
if e.phase == "ended" then
txt.text = "longer phrase"
end
end
txt:addEventListener("touch",txt)
The above code produces the error. Adding two lines (seen below) “fixes” the problem.
txt = display.newText("test",0,0,nil,48);
txt:setReferencePoint(display.CenterLeftReferencePoint);
txt.x = display.contentWidth \* 0.5; txt.y = 100;
function txt:touch(e)
if e.phase == "ended" then
txt.text = "longer phrase"
txt:setReferencePoint(display.CenterLeftReferencePoint); --reset reference point
txt.x = display.contentWidth \* 0.5; txt.y = 100; -- reset location
end
end
txt:addEventListener("touch",txt)
I submitted a bug report (8309). Am I missing something? [import]uid: 64596 topic_id: 15573 reply_id: 315573[/import]