Jump to content
Corona doesn't generate continuous events. Doing so would jam up the event system. Most people handle this through a combination of detecting the up and down state on the key, along with a flag indicating the state of the button (up or down) and a Runtime:enterFrame() listener that will continuously change the value you want while you detect the button is in a down state and when you detect the up state, you stop changing the value.
You have a choice of letting the OS handle those buttons, in other words, you don't intercept the key presses and let the device control its master volume. Or you can intercept the buttons to control the sound in your app while leaving the system sound volume alone.
The system slider is only going to show if you let the OS handle the buttons. Personally I never intercept the volume buttons. When you set the volume in your app, you're setting it to a percent of the device volume. If the user has their sound at 30%, 100% in your game is 30% of the device volume. Think of it as the volume of your sounds relative to the users desired device setting.
I think what he means Rob is if you have a keyEvent listener and you return false for volume up and down the native functionality is still interrupted.
For example, outside of Corona press volume up button and the volume (and OS animation) will be smooth and continuous.
In Corona app, you press volume up and the OS slider moves around 5-10%. You have to keep pressing the same button to reach the desired level, It has always been this way.
Take this simple implementation...
function onKey( event ) if event.keyName == "back" and event.phase == "up" then --do something return true end return false end
This blocks the native (and repetitive) volume buttons. I would say this was a bug.
Community Forum Software by IP.Board