I would do it this way: add a signal_callback where you detect if "up" or "down" are pressed, if up is pressed "engage" a counter (like counterup = 255) if down is pressed engage counterdown = 255, then add just one tick callback where you check the counters and if they are !=0 apply the value of the counter to the alpha of the arrows images, then decrease the counter. In this way when the counter reaches zero tick callback doesn't hog your system changing alpha channel continuously.
local counterup = 0
local counterdown = 0
local fadespeed = 0.85
local snap = fe.add_artwork("snap",0,0,200,200)
snap.video_flags = Vid.ImagesOnly
local uparrow = fe.add_text("^",200,0,100,100)
uparrow.alpha = 0
local downarrow = fe.add_text("v",200,100,100,100)
downarrow.alpha = 0
fe.add_signal_handler( this, "on_signal" )
fe.add_ticks_callback( this, "tick" )
function on_signal( sig ){
if (sig == "up") {
counterup = 255
return false
}
if (sig == "down") {
counterdown = 255
return false
}
}
function tick( tick_time ) {
if (counterdown != 0){
counterdown *= fadespeed
if (counterdown < 1) counterdown = 0
downarrow.alpha = counterdown
}
if (counterup != 0){
counterup *= fadespeed
if (counterup < 1) counterup = 0
uparrow.alpha = counterup
}
}