Replace the
spriteID with the number of the sprite you are working with.
for f = 255 to 0 step -1
SetSpriteColorAlpha(spriteID, f)
sync()
sleep(f)
next f
It may take a second or two to start doing its thing.
If it gives you any trouble then take the sleep(f) line out.
Here is another way that won't pause your main loop...
Global mlc
mlc = 0
Global f
f = 255
// main loop
do
mlc = mlc + 1
If mlc > 9
mlc = 0
f = f - 1
if f < 0 then f = 0
SetSpriteColorAlpha(spriteID, f)
endif
sync()
loop
Now, the reduction of f is only happening every tenth time through the main loop thanks to the main loop counter (mlc).
Depending on the speed of your main loop, you would adjust the number 9 in the 'if mlc > 9' line, so it would do it more or less often.
Or, you could take off more than 1 in the fade as in... f = f - 5
Setting the 9 to 3 and the 1 to 5 seems to work nicely in my test.
Give that a whirl and see what happens.