Hi,
I’ve faced this problem while migrating from widget v1.0 to widget v2.0. It was working great with widget v1.0 but now, I have this problem:
When I try to change the button label with an event, setLabel method just messes up with the labelYOffset.
Actually button:setLabel is the problem. It doesn’t matter if it’s attached to an event or not.
These are screenshots to what happens:
…and this is my code.
local function onButtonRelease(event) if ( event.phase == "ended" ) then if ( event.target.id == "setSound" ) then if ( setSound:getLabel() == rosetta:getString("soundOn") ) then setSound:setLabel( rosetta:getString("soundOff") ) \_G.isSoundOn = false elseif ( setSound:getLabel() == rosetta:getString("soundOff") ) then setSound:setLabel( rosetta:getString("soundOn") ) \_G.isSoundOn = true end elseif ( event.target.id == "changeLanguage" ) then if ( counter == 6 ) then counter = 1 else counter = counter + 1 end rosetta:setCurrentLanguage("translations/" .. languages[counter]) if ( \_G.isSoundOn ) then setSound:setLabel( rosetta:getString("soundOn") ) else setSound:setLabel( rosetta:getString("soundOff") ) end local currentLang if (languages[counter] == "english") then currentLang = "English" languageID = "en" elseif (languages[counter] == "french") then currentLang = "François" languageID = "fr" elseif (languages[counter] == "german") then currentLang = "Deutsch" languageID = "de" elseif (languages[counter] == "turkish") then currentLang = "Türkçe" languageID = "tr" elseif (languages[counter] == "arabic") then currentLang = "Arabic" languageID = "ar" elseif (languages[counter] == "korean") then currentLang = "Korean" languageID = "ko" end changeLanguage:setLabel( rosetta:getString("changeLanguage") .. currentLang) mainMenu:setLabel( rosetta:getString("mainMenu") ) elseif ( event.target.id == "mainMenu" ) then director:changeScene("screens.mainMenu", "crossfade") end end end
Any help would be appreciated.
Thank you.