Hi Rob
Very clever, and also quite appropriate for my current project as I
explicitly want the object to be destroyed when I leave the movie.
Thanks Rob and Mark for your insights. The project was getting very
messy yesterday and I have tidied it up by using a manager manager,
didn't take too long either (gives self pat on back too!)
cheers
Jon
> -----Original Message-----
> From: Robert Wingate [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 12, 2000 1:44 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: <lingo-l> OOP - conventions, not urgent
>
>
> > 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
[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!]