Jon Rowe wrote:

>> I can't find a way to construct a movie without
>> using at least one global variable ... which holds
>> references to all the other objects and needs to
>> be accessible from all scripts.

Another of many ways to do this is to use sprite 1, spanning the whole
movie, as your top-level manager. You can replace calls into your global
super-manager object with calls to sprite 1.

One benefit here is that sprite 1 can contain as many different behaviors as
you'd like. So, for example, if you put ten different manager behaviors on
sprite 1, the sprite becomes a super-manager in itself; that is, you can
call any method in any of the behaviors just by calling sprite 1. The
downside is that you have to be careful not to reuse method names in the
various behaviors, and some would argue that defeats the purpose here, in
OOP terms.

Other benefits to this approach are that sprite 1 will get all
sendAllSprites calls and frame events, and you can take advantage of
beginSprite and endSprite to initialize and clean up.

-- Mark

(I've been using this technique myself lately, and like it ... For the sake
of argument, can someone say why they don't like it?)

[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