I’m having trouble getting an alert triggered by another alert to work…
I’m building a power-up system so when my user clicks unlock it checks whether the user can afford the power-up or not, if not, the user gets an option to get coins.
The first alert shows: Unlock & Cancel
The second Alert shows: Get coins & Cancel
I’m able to show the second alert, but other than displaying in the screen it wont do anything.
I created the second alert like this:
getCoinsAlert = native.showAlert( "Game", "You don't have enough coins. Would you like to get some?", { "Get Coins", "Cancel" }, onGetCoins )
and the function attached is this:
local function onGetCoins( event ) print("Getting Coins!") if "clicked" == event.action then local i = event.index if 1 == i then storyboard.gameVars.totalCoins = storyboard.gameVars.totalCoins + 50000 myCoinsLabel.text= storyboard.gameVars.totalCoins print("Total Coins: "..storyboard.gameVars.totalCoins) elseif 2 == i then end end end
Clicking the Get Coins button won’t even print “Getting Coins!”
Any ideas?