> 1. When, if ever, is it 'allowable' to access a property without using

No improvement on Mark's answer is necessary, so I'll leave it there.

> 2. I can't find a way to construct a movie without using at least one
> global variable

There is a way, but it may or may not work in your situation.  When you
instantiate your HQ object, you're probably doing something like this:

-- Movie script

global HQ
HQ = new( script "HQ" )

And your HQ parent's 'new' handler does this:

-- HQ Parent

on new me
  -- whatever
  return me
end

That is, 'new' is returning an obj pointer, and you're storing it in HQ.
Instead, you can instantiate the object this way:

init script "HQ" <-note the conspicuous lack of assigning a global

You replace the parent script's 'new' handler with 'init' (or other custom
handler), and it doesn't need to 'return me' before exiting.  Then, each
time you would've otherwise communcated with HQ like this,

HQ.speechMngr.speak( "words..." )

do this instead:

(script "HQ").speechMngr.speak( "words..." )

The point is, through the use of the 'script' keyword, you can communicate
directly with a (pseudo?) instance of the script, instead of storing its
pointer in a global.  I've used it for years when occasion called, without
incident.

The caveat is that since you're not storing HQ as a global, it doesn't have
global scope.  It works throughout the life of the .dir, but when you go to
another movie, its memory is released. It's a way to achieve movie-scope
objects, really (in addition to the obvious local & global).  So if your
program needs to change between several movies, you'll need at least one
global after all.

Hope this helps
Rob

/*********************************
* Rob Wingate, Software Human    *
* http://www.vingage.com         *
* mailto:[EMAIL PROTECTED] *
*********************************/

[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