I wrote my code so it would be
local time = 0
l = audio.loadSound("car.mp3")
local timeText = display.newText(time, 160, 400, "Helvetica", 26)
local startBtn = display.newImage( "start.png" )
startBtn.x = 50
startBtn.y = 300
local stopBtn = display.newImage("stop.png")
stopBtn.x = 270
stopBtn.y = 300
local function updateTime ()
time = time + 1
timeText.text = time
end
local function pressStart()
myTimer = timer.performWithDelay(1000, updateTime, 0)
audio.play(l)
end
startBtn:addEventListener("tap", pressStart)
local function pressStop()
audio.stop(l)
time = 0
timeText.text = time
timer.cancel(myTimer)
end
stopBtn:addEventListener("tap", pressStop)
and I want to loop the audio.
I tried to make a function but I could not set it up properly. Can someone help me? [import]uid: 39840 topic_id: 15614 reply_id: 315614[/import]
it shows you how to loop audio + all the other audio functions :