Native Alert: why only once?

Dear all,

I am new on Corona SDK, so please forgive this simple question! I am trying to achieve a very simple thing: displaying an object (image), and when tapped, display an alert.

I succeeded in having a main and a module (“logo”), and I can display the image with this:
[lua]-- Load logo library
local logoLib = require(“logo”)
local logo = logoLib.logo

logo:addEventListener(“tap”, logo)[/lua]

However, in the simulator every time I tap I get the alert. On my device (a Galaxy Tab 10), it works only once. It never worked more than once even when creating a single file.

What am I missing? I know it must be something really stupid…

Thanks for any hint!
[import]uid: 94362 topic_id: 16555 reply_id: 316555[/import]

It’s something simple.

Post up some more code (ie, how your handling the alert etc) and we can help properly :slight_smile: [import]uid: 84637 topic_id: 16555 reply_id: 61851[/import]

Well the code is this:

main.lua
[lua]-- Load logo library
local logoLib = require(“logo”)

local logo = logoLib.logo

logo:addEventListener(“tap”, logo)[/lua]

logo.lua
[lua]module(…, package.seeall)

–logo = display.newRect(100, 100, display.contentWidth/10, display.ContentHeight/10)
–logo.setFillColor(136, 29, 35)

logo = display.newImage(“img/logo.png”, 10, 20)

function logo:tap(event)
native.showAlert(“The title!”,
“native.showAlert( title, message [, buttonLabels [, listener]] ) Displays a popup alert box with one or more buttons, using a native alert control. Program activity, including animation, will continue in the background, but all other user interactivity will be blocked until the user selects a button or cancels the dialog.”)
end[/lua]

As you can see I tried to paint the screen red, without success. I probably need to study more because I didn’t quite get how to implement even simple things!

Thanks!
[import]uid: 94362 topic_id: 16555 reply_id: 61854[/import]

Your going about it wrong in a few ways.

Take a look at this, it has a working example :

http://developer.anscamobile.com/reference/index/nativeshowalert [import]uid: 84637 topic_id: 16555 reply_id: 61858[/import]

Thanks for the pointer! Now it all works perfectly! [import]uid: 94362 topic_id: 16555 reply_id: 61873[/import]