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: 
Highlighted
Level 7

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
Highlighted
Level 9

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
Highlighted
Level 7

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
Highlighted
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
Highlighted
Level 7

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
Highlighted
Roku Employee
Roku Employee

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