I have several functions each calling a different mapView. I have a back button that removes them... is supposed to anyways. I have tried setting the object .isVisible = false, removeSelf() and even = nil and nothing gets rid of the mapView.
Any thoughts?
I just modified one of the buttons in the MapView sample to remove the map and it worked (build 567).
1
2
3
| local button3Release = function( event )
myMap:removeSelf() -- remove the map object
end |
I'm using 574 so let me go back a few builds and try again
Didn't matter... This may have something to do with CoronaUI list and not directly with the mapView. I am going to try to destroy it by other means.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
| -- 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 |
views:1696 update:2011/9/28 9:01:40