So, I’m following a YouTube tutorial and my code is the same as the one in the video, but the sound file is not playing.
\_W = display.viewableContentWidth \_H = display.viewableContentHeight local pop = audio.loadSound("ring.mp3") local btn = display.newImageRect("btn.png", 250, 125) btn.x = \_W/2 btn.y = \_H/2 local function btnsound(e) if(e.phase == "ended") then audio.play(pop) end end btn:addEventListener("touch", btn)
the only difference is that the guy’s function is global and mine is local, but I tried it both ways and there’s no difference. The sound name is correct, it’s in the main.lua folder, when I put a line “audio.play(pop)” below everything it plays. So it’s got to be something in the function I think. Help! :D
Thanks.