Having trouble with Alert messages repeating

This code snippet is part of an app that does some text entry and uses button to sign in, write, etc.

It worked with SDK 2.0 (or maybe earlier, vintage July 2010)
With 2.268 it is repeating the alert on every button event, instead of the normal button event.

If I don’t do anything to fire an alert all is well but once an alert fires the next button click will fire the same alert again, even though unrelated.

I’m either missing a remove in the alert code or perhaps have to redo my button code?

  
local function onComplete( event )  
 print( "index =\> ".. event.index .. " action =\> " .. event.action )  
  
 local action = event.action  
 if "clicked" == event.action then  
 --if 2 == event.index then  
 -- Open url if "Learn More" was clicked by the user  
 -- system.openURL( "http://developer.anscamobile.com" )  
 --end  
 elseif "cancelled" == event.action then  
 -- our cancelAlert timer function dismissed the alert so do nothing  
 end  
end  
  
-- alert function  
function alertmsg(titlemsg,msg)  
 alert = native.showAlert( titlemsg, msg, { "OK" }, onComplete )  
 timer.performWithDelay( 8000, cancelAlert )  
 --cancelAlert()  
end  
  
-- Dismisses alert after 10 seconds  
function cancelAlert()  
 native.cancelAlert( alert )  
end  

My button code:

function onLogin( event )  
 print("In onLogin")  
 native.setKeyboardFocus( nil )  
 username = usernameField.text  
 usernameField.isVisible=false  
 loginButton.isVisible=false  
 if username == "" then  
 username = "Byted"  
 ip = "192.168.2.110"  
 port = "5014"  
 end  
 t:setText( username.." is signed in - "..port )  
 invtbinButton.isVisible = true  
 invtlocButton.isVisible = true   
 aboutButton.isVisible = false  
 --ipButton.isVisible = false  
 setupButton.isVisible = false  
end  
  
loginButton = ui.newButton{  
 default = "smallButton.png",  
 over = "smallButtonOver.png",  
 onPress = onLogin,  
 text = "SIGN IN",  
 font = "Helvetica-Bold",  
 size = 13,  
 textColor = { 225, 225, 225, 255 },  
 emboss = true,  
}  
  
loginButton.x = 162  
loginButton.y = 150  
  

Still long way to go to be competent in Corona, so a lot of code scavenging.

Any help/suggestions greatly appreciated. Still can’t get my head wrapped around groups, so most of my interaction is via buttons and making labels, textboxes, etc. visible/invisible.
[import]uid: 6547 topic_id: 6965 reply_id: 306965[/import]