Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jnicholas
Level 7

Checking existence of function

I was testing my channel on an older Roku running Firmware 3.1 and got this error

Member function not found in BrightScript Component or interface. (runtime error &hf4) in ...G56RN/pkg:/source/appMain.brs(98)
098: busydialog.EnableOverlay(true)

which leads to two questions.

1) Is there a way to check if an function is available before calling it? For example in javascript you could do this
if (busydialog.EnableOverlay) {
busydialog.EnableOverlay(true)
}

2) according to the docs (http://sdkdocs.roku.com/display/sdkdoc/ifMessageDialog) the EnableOverlay is listed as available since version 2.7. So why does it fail on a 3.1 box?
0 Kudos
1 Reply
belltown
Level 7

Re: Checking existence of function

I'm pretty sure I've used ifMessageDialog.EnableOverlay(true) with the 3.1 firmware. Are you sure that busydialog really is an roMessageDialog? Try putting a breakpoint (stop) before the call and print type(busydialog)

As far as testing if specific functions are supported, I don't know if that's possible, although you can test for specific firmware versions using roDeviceInfo. I'm sure there are a zillion different ways of doing this; here's one of the methods I use:


Function getRokuVersion () As Object
vsn = {major: 0, minor: 0, build: 0}
diVsn = CreateObject ("roDeviceInfo").GetVersion ()
majMin = (Mid (diVsn, 3, 4)).Tokenize (".")
If majMin.Count () > 0 Then vsn.major = majMin [0].ToInt ()
If majMin.Count () > 1 Then vsn.minor = majMin [1].ToInt ()
vsn.build = (Mid (diVsn, 9, 4)).ToInt ()
Return vsn
End Function

' Example use:
vsn = getRokuVersion ()
settings.seekSupported = vsn.major >= 5
https://github.com/belltown/
0 Kudos