I want to have buttons in an app that “flash”. I was planning on doing that by changing the bitmap on a button. I haven’t figured out how to do that, but I did figure how to hide a button. So, to prototype what I want to do, I tried hiding the button and showing it to simulate flashing.
I am using the timer function to execute the flash logic, but it doesn’t work the way I think it should.
This code:
local function flash( event )
print ( "flash" )
if b10.isVisible
then b10.isVisible = false
else b10.isVisible = true
end
end
function MainHandler( event )
timer.performWithDelay( 5000, flash, 0 )
end
Runtime:addEventListener("enterFrame", MainHandler)
Causes the B10 button to be solid for five seconds, then it flashes really fast off and on for five seconds, then solid again and back and forth. I would expect it to turn on for five second, off for five seconds and alternate that every five seconds, but it doesn’t. Am I reading the code reference wrong? Or is this a bug?
Any other suggestions (including an example of how to change the bitmap on a button) would be greatly appreciated!
Thanks. [import]uid: 25195 topic_id: 5421 reply_id: 305421[/import]