writing text without overwrite background image

Hi, im totally new, so bear with me please

I have a small app which prints some cordinates on the screen in my gameloop

      local myText = display.newText( player3.x, 200, 200, native.systemFont, 16 )

problem is after some time, my text have ruined my backgound image.

here is my backgound code

local ground = display.newImage(“background.PNG”)
ground.x = 160
ground.y = 300
ground:scale (0.5,0.5)

i can make it work by refreshing the background image in my gameloop, but it just not seem very effecient to me??

So without know much about Corona or game development, im guessing i need some kind of layer function or something? does it exist?

example pics

just after kaunch app in simulator

http://imgur.com/2HZ5gPx

after a few seconds

http://imgur.com/MExKwjK

thank you

The images are hard to see.  Can you post your full code?

I assume you have your text creation code inside of a timer or Runtime listener, and that the text is being created on a loop rather than updating the actual string that the initially created text object has.

The solution is to create the text object outside of the loop, and update the text string  inside the loop. See the below API for more info:

https://docs.coronalabs.com/api/library/display/newText.html#updating-the-text-string-post-creation

moved the object outside gameloop and now update it inside gameloop.

It Works

thank you

The images are hard to see.  Can you post your full code?

I assume you have your text creation code inside of a timer or Runtime listener, and that the text is being created on a loop rather than updating the actual string that the initially created text object has.

The solution is to create the text object outside of the loop, and update the text string  inside the loop. See the below API for more info:

https://docs.coronalabs.com/api/library/display/newText.html#updating-the-text-string-post-creation

moved the object outside gameloop and now update it inside gameloop.

It Works

thank you