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

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

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