Monday, September 19, 2005, 11:47:17 PM, Michael wrote:

MM> Actually, I really, really like the
MM> static attribute and hope it may find its way into lingo at some point.

Are you aware that you can set and get the properties of a script object? - 
that is, the properties of an uninstantiated script as opposed to an instance 
of it. So for example, instances of a script can each refer to 
'me.script.propertyName', and they all therefore have access to that same 
property, essentially a 'static variable'-esque property.

In the same way, you can also call the handlers of an uninstantiated script 
object, and therefore any instances of a script can call the 'static' version 
of the handler by calling: me.script.handlerName()

Here's an example of a shared click counter, using this method:
www.robotduck.com/content/articles/director/programmingTechniques/sharedCounter

And here's an example of a simple game which uses this method extensively for 
communication with (and between) multiple instances of the same behaviour:
www.robotduck.com/content/articles/director/gameSystems/asteroidGame


- Ben

_______________________
 duck_at_robotduck.com 
   www.robotduck.com   

[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