jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017
11:39 AM
callFunc() not working with Group
I am trying to call a function within a component that extends Group. I placed the function within the component's XML interface:
Within the function that is defined in the component's brs file, I place a line that should output to my debugging window; however, that line never gets outputted to the debug window.
This is how I am trying to call the function:
So it appears that the function is never called. However, I do the same thing with a few screens which are also components that extend group and and the function in those cases is called properly. The one difference is that the screens are dynamically added to the scene by calling the following code:
What could be the issue here? Why can't I successfully call callFunc() with the group component?
<function name="highlightItem" />
Within the function that is defined in the component's brs file, I place a line that should output to my debugging window; however, that line never gets outputted to the debug window.
sub highlightItem(index)
?"highlightItem() has been called"
end sub
This is how I am trying to call the function:
m.menuGroup.callFunc("highlightItem", 1)
So it appears that the function is never called. However, I do the same thing with a few screens which are also components that extend group and and the function in those cases is called properly. The one difference is that the screens are dynamically added to the scene by calling the following code:
screen = createObject("roSGNode","Screen1")
m.screensGroup.appendChild(screen)
What could be the issue here? Why can't I successfully call callFunc() with the group component?
2 REPLIES 2
jaxim
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017
01:37 PM
Re: callFunc() not working with Group
nevermind. The problem was due to me targeting the incorrect variable. Instead of m.menuGroup the code should have been targeting a different variable within the code. callFunc() works as intended.
tim_beynart
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2017
10:28 AM
Re: callFunc() not working with Group
Thanks for posting this! I always thought callFunc() required an associate array as the second parameter.
In the docs it says,"Any context from the caller can be passed to the function via an associative array, which is fully converted/cloned on call."
See here:
https://sdkdocs.roku.com/display/sdkdoc/Handling+Application+Events#HandlingApplicationEvents-FunctionalFields
In the docs it says,"Any context from the caller can be passed to the function via an associative array, which is fully converted/cloned on call."
See here:
https://sdkdocs.roku.com/display/sdkdoc/Handling+Application+Events#HandlingApplicationEvents-FunctionalFields