I posted a few years ago in the Code exchange regarding the welcomed “slider component” (based on the Button component in ui.lua). I try without success to control with a slider the sound volume, but have difficulty with CoronaLuaSyntax.
In ObjectiveC, I write, for the method:
-(IBAction) updateVolume {
[mediaPlayer setVolume:slider.value]
}
What’s the equivalent in CoronaLua to catch the value of the slider in a function?
require “slider”
local eventHandler = function (event)
media.setSoundVolume() --??? doesn’t work
end
I looked at the code for that slider. Looks like there needs to be an “update” function on it that you can call, once you change its value. There isn’t one there, but within the “newSlider” function you could add:
function slider:update()
-- do stuff here with "self.value", or "slider.value"
end
In your screen:
mySlider.value = .5
mySlider:update()
This slider component should have been made to accommodate for that. I don’t see much value in it as it is… [import]uid: 4454 topic_id: 2801 reply_id: 8593[/import]