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: 
lock_4815162342
Channel Surfer

Where is the m object declaired in the videoPlayer example?

I am trying to set up a category grid to sub category grid interface. I am having a difficult time getting the XML of the sub categories to feed right.

I think that finding out were the m object comes from or where it is created will help.

Here are some examples of its usage.

m.Categories.Kids
m.Categories = conn.LoadCategoryFeed(conn)
m.categories.kids.count()


I have looked and can not find its source. Is it some magical built in object? :shock:

I appreciate any answers about this object or any tips on setting up a multi grid interface it is really racking my brain
0 Kudos
2 REPLIES 2
joetesta
Roku Guru

Re: Where is the m object declaired in the videoPlayer examp

Is it some magical built in object?

Yes, this may help;
http://sdkdocs.roku.com/display/sdkdoc/ ... sicObjects
aspiring
0 Kudos
EnTerr
Roku Guru

Re: Where is the m object declaired in the videoPlayer examp

"m" roughly corresponds to "self" or "this" in object-oriented languages.

It is a very clever hack that gives the impression of object-orientedness. It seems to me the implementation mechanics is: when invoking function in the form "someAA.aaElement(...)" (where someAA is associative array, aaElement is a key in it, pointing to a function) - before the function is invoked, someAA will be shoved in "m" so the function code has access to the sibling "attributes" from AA. And thus, we call the function "method". Not OO proper but gives you 80% of the functionality (Pareto fans anyone?).
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.