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: 
panzhuli
Visitor

multiple canvases? newbie question

hi all. i'm trying to ad an ad on my channel. I'm running into a problem when there's another object on the canvas. We're putting up a channel information overlay when the user switches to a different channel. At the same time, I'm using this opportunity to test putting an ad up on the screen. This isn't appearing, tho... I tried using the same canvas object, different layer, to no avail. so then I thought I'd create a separate canvas to handle the ad. Is this supported? In general, the image isn't showing up either way.

Here's the code that puts up the channel info bar:


m.canvas.AllowUpdates(false)
m.updateInfo()
m.canvas.Show()
m.canvas.AllowUpdates(true)
m.channelBarActive = true

where updateInfo() is:
m.canvas.SetLayer(3, [m.meta.backgroundImage]) //we store an object with a reference to an image here....


Ideas? Thanks
0 Kudos
3 REPLIES 3
destruk
Streaming Star

Re: multiple canvases? newbie question

Perhaps you have the layers backwards - layer 1 would be drawn in back of layers 2 and 3. Layer 0 is the bottom most layer possible. The component reference guide says you can use negative values, however, those will be drawn as invisible.
0 Kudos
TheEndless
Channel Surfer

Re: multiple canvases? newbie question

What's your "m.meta.backgroundImage" code, and why are you passing it in an array? I would suspect something about that setup as being the culprit.
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
kbenson
Visitor

Re: multiple canvases? newbie question

"TheEndless" wrote:
What's your "m.meta.backgroundImage" code, and why are you passing it in an array? I would suspect something about that setup as being the culprit.


Indeed. If that isn't a data structure appropriate for passing into a setLayer() call (i.e. if it's just a filename...) that will cause a problem.

As to your question about multiple canvas objects, they work in theory and somewhat in practice, with major drawbacks. One of the drawbacks with multiple canvas objects (underlying canvas object is just left as existing back buffer image) will probably interact badly when used as an overlay for video, since the video is overwriting the back buffer...
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.