1 Reply Latest reply on Dec 7, 2006 6:08 PM by ZodiacHSX

    Javascript - Access sub-properties of lists

      I've got a very basic problem: I want to assign a color to a line inside a field.

      Basically, this is all that's needed for doing this in Lingo:
      member.line [ i ] .color=color(255.128.128);

      However, a requirement for my studies is that I have to do it in Javascript and the dot notation doesn't work there... instead you use setProp... so by normal JS standards this should work:

      However, for some reason that I'm 100% unable to understand member.getProp("line",i) doesn't return an object... instead it returns a string!?!

      So I need a way to access nested properties directly via setprop... I've tried this:
      In the hope that Director would parse the "line["+_mouse.mouseLine+"].color" bit to get to the correct property... but sadly it doesn't.

      Any help would be VERY welcome :)
        • 1. Re: Javascript - Access sub-properties of lists
          ZodiacHSX Level 1
          Found the solution: You've got to use getPropRef:

          What I find really disturbing is that this is probably the 110th method that I've found in a few forums, but not in the documentation... it's simply not listed and even a fulltext search does only provide a single half-sane result: "Choosing between Javascript and Lingo Syntax", the rest are functions that have nothing to do with properties, they just need it for their examples.

          I'm sorry, but you guys really have to get your act together documentation-wise!