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: 
360tv
Streaming Star

Problem with ToHexString()

When I try and use ToHexString() on a variable, It crashes with "Member function not found in BrightScript Component or interface."

Simple use such as


fadelevel = 255
print fadelevel.ToHexString()


Am I using it wrong?
0 Kudos
5 REPLIES 5
TheEndless
Channel Surfer

Re: Problem with ToHexString()

ToHexString() is an roByteArray method, not an integer method.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
360tv
Streaming Star

Re: Problem with ToHexString()

Is there no way to convert a int or a string to a hex value? I have to do it from an array? cause I only have one value to convert, not an array of values. Unless I'm misunderstanding.
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Problem with ToHexString()

I think you're confusing roArray with roByteArray. You can create a roByteArray from an ASCII string, then call ToHexString() on it. http://sdkdocs.roku.com/display/sdkdoc/roByteArray
0 Kudos
renny_oh
Reel Rookie

Re: Problem with ToHexString()

Just for those who look for further ..
1. SDK
https://sdkdocs.roku.com/display/sdkdoc ... +Functions

print StrI(255, 16) '= "ff"

2. Git Integer to Hex String Roku BrightScript
https://gist.github.com/kaayr1m/cacd3432b53fd854b0de
0 Kudos
NB_
Roku Guru

Re: Problem with ToHexString()

Umm... please don't do #2.
That function is not written efficiently, plus as the author notes in comment - there is a better way.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.