Hello guys
I ve a textBox and every 36 letters, the textBox’s width ends and the cursor warps.
When I click a button an image must move.
This image should move 2 pixels if the text consists of a single row
4 if the text is composed of 2 rows and so on.
this i my code but it is not very good and it doesn’t work can someone correct me??
local textBox = native.newTextBox( 135, 500, 260, 35 ) textBox.isEditable = true local img= display.newImage("invia.png") img.width = 35 img.height= 35 img.x = 290 img.y= 498 function inputListener( event ) if event.phase == "began" then textBox.height = 45 send.y = 278 textBox.y = 270 print( event.text ) end if event.phase == "editing" then print( event.newCharacters ) print( event.oldText ) print( event.startPosition ) print( event.text ) end end textBox:addEventListener( "userInput", inputListener ) function move(event) if event.phase == "began" then if ( string.sub(textBox.text ,36) ) then image.y = image.y - 2 end if ( string.sub(textBox.text ,37) ) then image.y = image.y - 4 end if ( string.sub(textBox.text ,74) ) then image.y = image.y - 6 end end end img:addEventListener("touch" , move)
HELPPP