At 12:08 PM -0500 12/13/00, Ian Jempson wrote:
>I'm new to Lingo so please forgive me if I'm asking some dumb questions to
>begin with. I have a couple of questions at the moment.
>
>In a few scripts I have noticed that there are  references to Public
>methods in the comments. Nowhere do I see any ability to specify the scope
>of a method by designating it as Public, Private or Protected. Is there any
>ability to restrict  the scope of access in the same way as in other object
>oriented languages? Likewise I would ideally want to prevent any external
>access to properties of an object apart from using a Get or Set method.
>Possible?
>


Ian,

Welcome to the wonderful world of Lingo.  No need to ask forgiveness 
as your questions are not dumb.

In Lingo, there are three different types of scripts: Movie, Parent, 
and Behavior.  Any "handlers"  put into a Movie script are globally 
available.

Parent scripts and Behavior scripts are the templates used for 
creating objects, so the scope of handlers (methods) in Parent 
scripts and Behavior scripts is restricted to the current script.  If 
you use a parent script, you must explicitly create an object by 
calling it's "new" method.  Behavior scripts are attached by the 
programmer by dragging from the castlib to a sprite in the score. 
Instantiation is done automatically for you when the play head 
reaches the sprite span - and the behavior is eliminated 
automatically for you when the play head leaves the sprite span.

As for Public and Private, (I don't know what Protected means), in 
Lingo, all methods are Public.  It has been discussed here many times 
that it would be very nice to have a Private method.  A good 
suggestion is to have some naming convention to identify the 
differences between methods intended to be public vs private, e.g.

on mDoThis me  --- public method, starts with an "m"

on imDoThis me  -- internal method, starts with an "i"

Finally, in Lingo, unfortuantely, you can directly address any 
property of any object by using the syntax: 
gSomeObject.pSomeProperty.  But I strongly advise never to do that. 
(Other's here have felt that's OK to get the value of properties). 
Instead, I often have suggested the use of Getter and Setter methods.

Good luck,

Irv
-- 
Lingo / Director / Shockwave development for all occasions.

        (Over two millions lines of Lingo code served!)

[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