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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Channel Surfer

Stop a task running in background

I have a menu with four options. Each time a menu item is focused, an API is hit for the specific menu. 
If a user switches focus between different menu at a faster rate I need to stop the task created for the previously focused menu. How can I do that?
I am showing a menu using a RowList on MainScene. The menu switching takes place on rowItemFocused of row list.
So anything I need to do has to be done from the main scene.
0 Kudos

Re: Stop a task running in background

You need to stop the task using the task node's control field.

So just grab a reference to the task that you previously started and set task.control="stop"

Let me know if you are unclear about this or need any further help. Also hit me up on the Roku Developers Slack Channel for quicker response. (see my signature)
Join the Roku Developers Slack Workspace for quicker help and great dev collaboration:
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.