At 9:19 -0500 01_01_23, Patrick Griffiths wrote:
>Sorry, no class variables in Director. Since Director doesn't have any
>notion of encapsulation/data hidding (like C++ public, protected, private),
>then static variable don't really make sense because they degenerate into
>globals.
Earlier I had written:
>The class pretty much corresponds to the script.
>You can access properties of the script as well as properties of
>script instances, so properties of the script would correspond to
>class variables.
>
>the script can be addressed from an instance (D8) like so:
>me.script
>So a class variable could be addressed like so:
>me.script.pClassVar
But apparently something in the transmission...
Anyway, below some code to illustrate my point, that you can easily
make something quite similar to class variables:
----<score script: staticTestBhv>----
on beginSprite me
put #init
tList = []
repeat with i = 1 to 4
tList.add(script("staticClass").new())
end repeat
put #test
call #mTest, tList
end
----</score script: staticTestBhv>----
----<parent script: staticClass>----
property pClass
property pClassTest
property pClassInstanceCount
on new me
pClass = me.script
if pClass.pClassTest.voidP then pClass.pClassTest = #static
pClass.pClassInstanceCount = pClass.pClassInstanceCount + 1
put #count, pClass.pClassInstanceCount
return me
end
on mTest me
put #count, pClass.pClassInstanceCount, #test, pClass.pClassTest
end
----</parent script: staticClass>----
-- Welcome to Director --
-- #init
-- #count 1
-- #count 2
-- #count 3
-- #count 4
-- #test
-- #count 4 #test #static
-- #count 4 #test #static
-- #count 4 #test #static
-- #count 4 #test #static
Jakob
[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!]