This is a perfect application for a movieClip animation.
Create your different button states: red.png, green.png, yellow.png and so on and setup a movie clip with each image.
You won’t be able to use a pre-factored button widget, like the one in the ui library, or the widget library.
This is UNTESTED code but should get you going:
local buttons = movieclip.newAnim({"red.png", "orange.png", "yellow.png", "green.png", "blue.png"})
local currentButton = 1
buttons:play{startFrame=currentButton, endFrame=currentButton, loop=1, remove=false}
local function onTap(event)
currentButton = currentButton + 1
if currentButton \> 5 then
currentButton = 1
end
buttons:play{startFrame=currentButton, endFrame=currentButton, loop=1, remove=false}
end
buttons:addEventListener("tap", onTap)
[import]uid: 19626 topic_id: 16998 reply_id: 63783[/import]