I have done my research before posting this topic 
I am developing an app which includes an image as well as a ui slider.
When the user moves the slider, a mask is set on the image, depending on the value of the slider.
My issue is whenever I move the slider more then one time to one value, the display image suddenly disappears?!
I have already checked to make sure my branching statements work properly. I have also worked with masks in other parts of my program, and have not had any issues.
My code looks as such:
--the name of the display object used was declared as dice earlier in code
local mask1 = graphics.newMask("images/mask/mask1.png")
local mask2 = graphics.newMask("images/mask/mask2.png")
local mask3 = graphics.newMask("images/mask/mask3.png")
local mask4 = graphics.newMask("images/mask/mask4.png")
local mask5 = graphics.newMask("images/mask/mask5.png")
local maskSliderListener = function( event )
local sliderObj = event.target
dice:setMask(nil)
print( "New value is: " .. event.target.value )
if (sliderObj.value == 100) then
dice:setMask(mask1)
print(5)
elseif (sliderObj.value \>= 75) then
dice:setMask(mask2)
print(4)
elseif (sliderObj.value \>= 50) then
dice:setMask(mask3)
print(3)
elseif (sliderObj.value \>= 25) then
dice:setMask(mask4)
print(2)
elseif (sliderObj.value \> 0) then
dice:setMask(mask5)
print(1)
elseif (sliderObj.value == 0) then
print(0)
end
end
local maskSlider = widget.newSlider{
width=160,
callback=maskSliderListener
}
maskSlider.x = display.contentWidth \* 0.5 - 200
maskSlider.y = display.contentHeight \* 0.5 + 250
maskSlider.width = 400
maskSlider.value = 0
group:insert( maskSlider.view )
Any help would be appreciated! [import]uid: 34103 topic_id: 15949 reply_id: 315949[/import]