Genevieve Young wrote

> owever, does this mean:
> 
> i. a behavior is a class?
> 
> v.  and therefore a behavior is somewhat similar to a  parent script?
> 
> vi. and  so behaviors can be used to create objects?

My 2 cents worth: 

A script creates an object. A script is like a template from which you can
make many objects. This "script member" is equivalent to what other
languages call a "class". In Director, you can make objects from movie
scripts, behaviours, frame scripts, cast member scripts, parent scripts,
text members and even raw chunks of string.

The reason that parent scripts and behaviours are normally used is because
(1) they have a limited scope compared to movie scripts (ie each movie
script handler must have a unique name otherwise the wrong handler might be
called) and (2) in the case of behaviours, they can be added to the score
and have data assigned via the 'getpropertyDescriptionList' stored with them
in the score. (In the old days - before behaviours - I'd sometimes use cast
member scripts on fields and store data in the field). Otherwise, there is
very little difference between the script type that you use.


Generally, the things which do all the real work are the objects - also
called the 'instances of the script'. However (just to make things more
confusing) - you can use uninstantiated scripts (which are good alternatives
to movie scripts in cases where you don't need to store data with the
script, but want scope protection - which is perhaps more relevant in
projects with multiple programmers )

  -- calling the handler of an object
  dog = script("Animal").new()
  dog.bark()

  -- calling the handler of a script
  script("Animal").bark()

What makes an object different from an uninstantiated script is that objects
are 'active' - in the sense that they exist in memory and are able to store
data (in their 'properties'). This is what makes objects more powerful than
uninstantiated scripts.

Its worth noting that event handlers such as "exitframe", "mouseDown" etc
are not unique features behaviours. The issue of whether Director will send
an object these messages depends not on the script type, but on where the
object (or uninstantiated script) is positioned in the 'event passing'
hierarchy. For example, a parent script will receive mouseDown events if it
has been added to a sprite's scriptInstanceList and that sprite is
positioned to receive the mouse event.

Luke



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/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