Hi everyone;
I am so close and yet so far from finishing my app, its a good thing I am not dependent for it to live on.
I have posted several times and still no resolution. Here is the problem code.
module(..., package.seeall);
function new()
local localGroup = display.newGroup();
local bg = display.newImageRect("images/elpasoatnight.png", \_W,\_H);
bg:setReferencePoint(display.CenterReferencePoint);
bg.x = \_W/2; bg.y = \_H/2;
localGroup:insert(bg);
--
-- display credits
--
credits = display.newText ( "Xela Development", 0, 0, "Helvetica-Bold", 12)
credits:setTextColor (255,128,255)
credits.x = 400; credits.y = 300;
localGroup:insert(credits);
--
-- back button
--
local back = ui.newButton{
default = "images/buttonBlueSmall.png",
over = "images/buttonBlueSmallOver.png",
onPress = "menu",
text = "back",
size = 10,
emboss=true
}
back.x = 35; back.y = display.statusBarHeight-1;
back.scene = "menu"
localGroup:insert(back);
--
-- check place to join
--
local places = ui.newButton{
default = "images/buttonBlueSmall.png",
over = "images/buttonBlueSmallOver.png",
onPress = "mapAddressHandler",
text = "places to join",
size = 9,
emboss=true
}
places.x = 105; places.y = display.statusBarHeight-1;
places.scene = "mapAddressHandler"
localGroup:insert(places);
--
-- setup for finding my address
--
myMap = native.newMapView( 20, 20, 300, 220 )
myMap.mapType = "standard"
myMap:nearestAddress( 38.898748, -77.037684)
myMap.x = display.contentWidth / 2
myMap.y = 120
localGroup:insert(myMap);
--
-- display my address
--
local function mapAddressHandler( event )
-- handle mapAddress event here
print( "Check in address: " .. event.city .. ", " .. event.country )
end
--
-- event listener
--
Runtime:addEventListener( "mapAddress", mapAddressHandler )
return localGroup;
end
Code is a module that gets called by “director” from a menu. I get no errors but it looks like the event listener is not firing. I am a little confused about how I call the event listener. Basically its a button but I am not getting to “mapaddresshandler”.
I am getting the map, even though its pointed to China when I am entering in the coordinates that GPS sampler program is giving. What I am really after is for “mapaddresshandler” to give the place down to city and address.
Could someone tell me what I am doing wrong please, it would be greatly appreciated.
Thanks [import]uid: 95689 topic_id: 26997 reply_id: 326997[/import]