Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
squirreltown
Level 9

fade

Trying to fade a graphic in on a roScreen.

trans=00
inc =5
while true
msg=wait(50, m.port)
trans=trans+inc
ba=createobject("roByteArray")
ba.push(255)
ba.push(255)
ba.push(255)
ba.push(int(trans))
hexcolor="&h" + ba.tohexstring()
? hexcolor
screen.drawobject( 410, 240, saverbitmap, hexcolor) 'LOGO
screen.swapbuffers()
End while

the byte array is incrementing properly
&hFFFFFF0D
&hFFFFFF12
&hFFFFFF17
&hFFFFFF1C
&hFFFFFF21
etc.

I am getting a type mismatch on the hexcolor variable above on the screen.drawobject line.
hexcolor &h8010 bsc:roString (2.1 was String), refcnt=1


I suspect it is some sort of issue between strings and integers but don't know how to deal with this with a hex value.
if i paste in a value from what the bytearray is outputting it shows the graphic fine.
would appreciate any help thanks.
Kinetics Screensavers
0 Kudos
2 REPLIES 2\
RokuMarkn
Level 8

Re: fade

That's a bit more complicated than it needs to be. You can do something like this instead of creating the bytearray:

hexcolor = &hFFFFFF00 + trans
0 Kudos
squirreltown
Level 9

Re: fade

Thanks Mark, that is indeed a lot simpler, and it works!
Kinetics Screensavers
0 Kudos