I am trying to add text and I encounter problems when using anchorX.
This is the small program:
button1 = display.newRect(290,450,50,50)
button1:setFillColor(1,0,0,1)
– línea vertical de referencia.
alineacionvertical = display.newRect( 290,250,1,300)
alineacionvertical:setFillColor(0,255,0)
C=1
A=1
Final = display.newText(C, 0, 0, “Helvetica”, 35 )
Final:setTextColor(255,255,255)
Final.anchorX = 1
Final.x = 300
Final.y = 342
local function AA (event)
A=A+1
if A>3 then
A=1
end
if A==1 then
C=1
end
if A==2 then
C=11
end
if A==3 then
C=111
end
Final.text= C
end
button1:addEventListener(“tap”, AA)
The red box is the button. Pressing I add text to the field. But I find that when anchorX = 0 works perfectly. Maintains position and add text smoothly. When anchorX = 1 there are small movements, and this is not desirable.
What am I doing wrong?