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: 
piyushg098
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
1 REPLY 1
BVatBBOD
Visitor

Re: Stop a task running in background

You need to stop the task using the task node's control field.  https://sdkdocs.roku.com/display/sdkdoc/Task

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: http://tiny.cc/nrdf0y
0 Kudos