Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
squirreltown
Roku Guru

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
Visitor

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
Roku Guru

Re: fade

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