Forum Discussion
mape
9 years agoVisitor
"EnTerr" wrote:
That's very interesting. Can you please tell me all places where you invoke Roku_Ads()? And where is the first place you call it? Is it possible you do that in the render thread?
1st place (successfully):
main.brs:
sub showChannelSGScreen()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("MainScene")
screen.show()
MakeSome() '<---- HERE
Where MakeSome() stored in athother file, same filder, name mixin.brs:
sub MakeSome()
ads = Roku_Ads()
Errorneous creation:
Task xml:
<?xml version="1.0" encoding="UTF-8"?>
<component name="CreateAdsTask" extends="Task" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">
<script uri="pkg:/components/CreateAdsTask.brs" />
<interface>
<field id="ads" type="assocarray" />
</interface>
</component>
Task script:
Library "Roku_Ads.brs"
Sub Init()
m.top.functionName = "createAds"
End Sub
sub createAds()
m.top.ads = Roku_Ads()
end sub
Invoking - in the main Scene (only one scene present in project):
m.adsTask = createObject("RoSGNode", "CreateAdsTask")
m.adsTask.observeField("ads", "setAds")
[size=85][font=Helvetica Neue, Helvetica, Arial, sans-serif] m.adsTask.control = "RUN"[/font][/size]
setAds:
sub setAds()
m.ads = m.adsTask.ads
Where m is current Scene.