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

Trying to construct a message port on a non-plugin thread:

I'm attempting to get the user's info for a sign up flow in a scene graph component.

I read that I'll need to construct the store object inside of Task. I also need to assign a port as described in the documentation so I can pull the user's info. I end up getting an error when running this code:

<component name="storeRegister" extends="Task">

<script type="text/brightscript" >
<![CDATA[

sub init()
store = CreateObject("roChannelStore")
port = CreateObject("roMessagePort")
store.SetMessagePort(port)
testUser = store.GetPartialUserData("email, firstname")
end sub


Error:

BRIGHTSCRIPT: ERROR: roMessagePort: Trying to construct a message port on a non-plugin thread: ...IQ/pkg:/components/store_register.xml(12)

013:* store.SetMessagePort(port)


How are others accessing store user data from within the scene graph API?
0 Kudos
2 Replies
TheEndless
Level 7

Re: Trying to construct a message port on a non-plugin threa

init() on a Task node is fired in the main SceneGraph thread. You need to set m.top.functionName and move your code to there, then set the control field of the task node to "RUN".
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jedashford
Level 7

Re: Trying to construct a message port on a non-plugin threa

Thanks, that was it. Makes sense now after your response and reading the docs Smiley Happy
0 Kudos