brocker
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011
10:21 AM
roAssociativeArray Logic
Hopefully a quick question. I'm trying to learn about the roAssociativeArray, and created the following, but am getting an error "Member function not found in BrightScript Component or interface."
Why doesn't this work ( I copied basic syntax from a previous demo )?
A demo project does something similar, and it compiles, so not sure what my issue is? Any advice?
Thanks
Bud
Why doesn't this work ( I copied basic syntax from a previous demo )?
Sub Main()
Web = SetAssociativeArray()
Web.ThisIsOne()
End Sub
Function SetAssociativeArray() As Object
Print "Set Array"
Web = CreateObject("roAssociativeArray")
Web.ThisIsOne = One
Web.ThisIsTwo = Two
End Function
Sub One()
Print "Hit One"
End Sub
Sub Two()
Print "Hit Two"
End Sub
A demo project does something similar, and it compiles, so not sure what my issue is? Any advice?
Thanks
Bud
5 REPLIES 5

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011
10:54 AM
Re: roAssociativeArray Logic
Your SetAssociativeArray function never returns an object. Add a "Return Web" to the end of it, and you should be in business.
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
brocker
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011
11:00 AM
Re: roAssociativeArray Logic
Jeeze, man what a silly mistake. Worked like a charm.
Thanks Endless, you are the best.
Regards
Bud
Thanks Endless, you are the best.
Regards
Bud

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011
11:04 AM
Re: roAssociativeArray Logic
Sure thing.. it may also be worth noting that your SetAssociativeArray function can be written using a different syntax that you might find preferable:
Function SetAssociativeArray() As Object
Web = {
ThisIsOne: One
ThisIsTwo: Two
}
Return Web
End Function
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
brocker
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011
11:12 AM
Re: roAssociativeArray Logic
Cool! That does read very nice. I've seen that in the reference guide, but hadn't spent any time reading about it.
To be sure, it still creates a AssociativeArray, but I just don't have to declare it with "CreateObject" like in my earlier code block?
Best
Bud
To be sure, it still creates a AssociativeArray, but I just don't have to declare it with "CreateObject" like in my earlier code block?
Best
Bud
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011
12:38 PM
Re: roAssociativeArray Logic
Correct. Another shortcut for creating an roAssociativeArray is this syntax:
-JT
Web = {} ' creates empty roAssociativeArray
Web.ThisIsOne = One
Web.ThisIsTwo = Two
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.