wst54321
9 years agoVisitor
RAF implemented in SceneGraph component thread issue.
Hi, All
I am trying to use the RAF in my components' brs instead of the main.brs, but I find both the getAds() and showAds call need a independent task node (which means been treated as and roUrlTransfer?).
Currently, my code logic is as follows :
1. In main.brs, I init the "HomeScene", set a roMessagePort
2. IN "HomeScene", I have a child which is a customized component extends "Video", called "PlayerNode"
3. In the "PlayerNode", I init the a "AdTask" node in order to make "getAds()"
However, here again after I get response, I can t call showAds here coz it gives me an error msg, seems the showAds also requires a seperate task node to accomplish the task
what is the correct way if I don t wanna put code in the main thread and I dont wanna a nested task node structure , I think I must think something wrong.
btw , after all, I also wanna know , how can my msgPort in the main.brs be able to listen to the "adPods" field which is defined in the "AdTask" node ? if I can get that to work, at least I can do the rest of the logic in the main thread, though the cons are it makes the ads handle code everywhere in the proj....( 😞 )
Thanks to any help !
I am trying to use the RAF in my components' brs instead of the main.brs, but I find both the getAds() and showAds call need a independent task node (which means been treated as and roUrlTransfer?).
Currently, my code logic is as follows :
1. In main.brs, I init the "HomeScene", set a roMessagePort
2. IN "HomeScene", I have a child which is a customized component extends "Video", called "PlayerNode"
3. In the "PlayerNode", I init the a "AdTask" node in order to make "getAds()"
However, here again after I get response, I can t call showAds here coz it gives me an error msg, seems the showAds also requires a seperate task node to accomplish the task
what is the correct way if I don t wanna put code in the main thread and I dont wanna a nested task node structure , I think I must think something wrong.
btw , after all, I also wanna know , how can my msgPort in the main.brs be able to listen to the "adPods" field which is defined in the "AdTask" node ? if I can get that to work, at least I can do the rest of the logic in the main thread, though the cons are it makes the ads handle code everywhere in the proj....( 😞 )
Library "Roku_Ads.brs"
sub init()
m.top.functionName = "getAdsContents"
end sub
sub getAdsContents()
adIface = Roku_Ads()
print "Roku_Ads library version: " + adIface.getLibVersion()
adIface.setAdPrefs(true,2)
adIface.setDebugOutput(true) 'for debug pupropse
adPodsArray = adIface.getAds()
end sub
Thanks to any help !