Thanks Bjarne, 

for the eye-opening examples of property access; I'm sure they can be
useful.
Until now, I had just used sprite(1).propname to get the value.

However, the direction of my question was more about the OOP "ethics" of
accessing properties directly, and how to find the balance between
encapsulation on the one hand, and avoiding redundant code on the other.

I'm trying to decide how seriously I should take the school of high
object integrity in Lingo. When I do, I feel I'm doing it for form's
sake. Still, I'm hoping that adhering to these strict and seemingly
silly rules will someday take me to the moment of OOP enlightenment that
some talk about.

regards, Clars






Bjarne Nyquist wrote:

> Consider this
> 
> in a behavior attacehd to sprite 1 i init a few properties, say
> 
> property fish, mammal, man, insect
> 
> Now this is possible:
> 
> put sprite(1).count
> which would return the number of properties of the properties of the fist behavior 
>in the scriptInstanceList of sprite 1
> 
> NOTE the property #spriteNum will be the last one in the list because it is created 
>by Director itself, so the number returned will be Your number of props + 1
> 
> Also this works
> put sprite(1).getPropAt(3)
> 
> returns
> -- #man
> 
> As will this
> put sprite(1)[3]
> 
> returns
> whatever value #man has in my example
> 
> If You have more than 1 behavior attached to a sprite You could use the same 
>techinque on the other ones by using
> 
> put sprite(1).scriptinstanceList[2].count
> 
> and
> 
> put sprite(1).scriptinstanceList[2].getPropAt(2)
> 
> Bjarne
> _______________________________________________________
> If it's true that we are here to help others, then what exactly are the OTHERS here 
>for?
> 
> Bjarne Nyquist
> Researcher, Lingo Programmer
> The Interactive Institute, phone: +46-(0)8 783 24 74
> www.interactiveinstitute.se
> 
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
> email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
> Lingo-L is for learning and helping with programming Lingo.  Thanks!]

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to