How to remove this?

Hi, I’ve written this code. It works and displays the name of the country, however I’d like to remove the text that appears as I change scene, but don’t know how to do it. Does anybody have an idea?

myMap = native.newMapView( 0, 0, 10, 10 ) myMap.mapType = "standard" sceneGroup:insert(myMap) myMap.x = display.contentWidth / 2 myMap.y = 1200 myMap:setCenter( 37.331692, -122.030456 ) local function address( event ) local cPos = display.newText( "".. event.country .. "" , 160, 290, "HelveticaNeue-UltraLight", 25) end myMap:nearestAddress( 38.898748, -77.037684, address )

P.S. I’m using the composer library

  1. Based on your code (see ‘changed’ and ‘new’ comments)

    local myMap = native.newMapView( 0, 0, 10, 10 ) – changed myMap.mapType = “standard” sceneGroup:insert(myMap) myMap.x = display.contentWidth / 2 myMap.y = 1200 myMap:setCenter( 37.331692, -122.030456 ) local function address( event ) local cPos = display.newText( sceneGroup:, “”… event.country … “” , 160, 290, “HelveticaNeue-UltraLight”, 25) – changed end myMap:nearestAddress( 38.898748, -77.037684, address ) – ‘new’ You’ll need to clear this once you’re done or it won’t get removed completely later myMap = nil

  2. I suspect, you didn’t post the code as it is actually written, but the primary fix is to put your text object in the scenegroup.

  3. Please format code with forums tools.  

formatyourcode.jpg

Thank you very much! 

I formatted the code  :slight_smile:

  1. Based on your code (see ‘changed’ and ‘new’ comments)

    local myMap = native.newMapView( 0, 0, 10, 10 ) – changed myMap.mapType = “standard” sceneGroup:insert(myMap) myMap.x = display.contentWidth / 2 myMap.y = 1200 myMap:setCenter( 37.331692, -122.030456 ) local function address( event ) local cPos = display.newText( sceneGroup:, “”… event.country … “” , 160, 290, “HelveticaNeue-UltraLight”, 25) – changed end myMap:nearestAddress( 38.898748, -77.037684, address ) – ‘new’ You’ll need to clear this once you’re done or it won’t get removed completely later myMap = nil

  2. I suspect, you didn’t post the code as it is actually written, but the primary fix is to put your text object in the scenegroup.

  3. Please format code with forums tools.  

formatyourcode.jpg

Thank you very much! 

I formatted the code  :slight_smile: