Janitor
Janitor

Reputation: 3

Corona SDK Tap event, Trigger only 1 event?

Sorry i couldn't be very specific in the question. I am working on an app, that links out to the internet.

I am having trouble with it, because it opens multiple tabs in the browser, from touching the button one time.

Usually 5 tabs are opened.

Here is my code... I'm sure it is as simple as stopping the function somehow, but i am still learning corona /lua coding.

Thanks for any and all help/suggestions!

--Party Button
local function partyListener( event )
    system.openURL( "http://www.themcgrawgalleria.com/party" )
    return true
end

local partyImage = display.newImage( "party.png" ,0 , 225,true)
partyImage.x = display.contentCenterX
partyImage.xScale = .25
partyImage.yScale = .25
partyImage:addEventListener( "touch", partyListener )

Upvotes: 0

Views: 309

Answers (1)

Krishna Raj Salim
Krishna Raj Salim

Reputation: 7390

You can use:

partyImage:addEventListener( "tap", partyListener )

Instead of:

partyImage:addEventListener( "touch", partyListener )

Because touch events has 3 phases named: began,moved and ended. So if you try a button click with touch event, you may call your listener in those phases. Using tap can solve your issue. For more details, visit: Corona-->touch and Corona-->tap

Keep Coding......... :)

Upvotes: 4

Related Questions