[lua]-- creates map for Orlando Office
myMap = native.newMapView( 10, 10, 300, 180 )
myMap.mapType = “normal” – other mapType options are “satellite” or “hybrid”
– The MapView is just another Corona display object, and can be moved or rotated, etc.
myMap.x = display.contentWidth / 2
myMap.y = 385
– Initialize map to a real location, since default location (0,0) is not very interesting
myMap:setCenter( 28.514876, -81.377577 )
myMap:addMarker( 28.514876, -81.377577, { title=“Downtown Office”, subtitle=“25 W. Crystal Lake St Suite 200” } )
myMap.isVisible = false
– function called when back button is pressed coronaui
function soundonPressDowntown(event)
media.playEventSound( “Tock.caf” )
downtownScreen:slideToRight( officeScreen)
downtownImage.isVisible = false
myTextObjectDowntown.isVisible = false
myTextObjectDowntown2.isVisible = false
callButton.isVisible = false
orlandoOffice.isVisible = false
myMap.isVisible = false
myMap:removeSelf()
end
– item selected from xml scroll list made with coronaui
function downtownInfo( item )
if officeScreen then
media.playEventSound( “Tock.caf” )
officeScreen:slideToLeft( downtownScreen )
downtownScreen:addBackButton (soundonPressDowntown)
downtownImage.isVisible = true
myTextObjectDowntown.isVisible = true
myTextObjectDowntown2.isVisible = true
callButton.isVisible = true
transition.to(callButton, {time=1,alpha=1,x=(225),y=(170)})
local isAndroid = “Android” == system.getInfo(“platformName”)
if isAndroid then
orlandoOffice = display.newImage(“orlandooffice-android.png”)
orlandoOffice.x = _W/2; orlandoOffice.y = 385
else
myMap.isVisible = true
end
else
end
end[/lua]
The above code works to display the Map when the downtown office is selected but when the back button is pressed it stays there… if on Android it properly removes the png file and either platform properly removes the other display objects from view when going back. Not sure why the MapView sticks and never goes away.
[import]uid: 18783 topic_id: 12606 reply_id: 46137[/import]