You could create a global object that maintains a single property
list (untested)
global goGlobals -- global object, globals
on startMovie
goGlobals = new(script "Globals")
end
on stopMovie
goGlobals = VOID
end
-- Globals parent script
property plVariables -- property list of variables, each is Name:value
on new me
plVariables = [] -- initialize to empty
end
on mAddVariable me, theName, theValue
addProp(plVariables, theName, theValue)
end
on mGetValue me, theName
theValue = getAProp(plVariables, theName)
if voidp(theValue) then
alert("Undefined variable:" && theName)
end if
return theValue
end
Then whenever you want to define a new variable:
global goGlobals
goGlobals.mAddVariable("MyNewVariableName", 5)
And to get a value:
global goGlobals
theValue = goGlobals.mGetValue("SomeVariableName")
Irv
At 2:57 AM -0400 9/6/01, [EMAIL PROTECTED] wrote:
>In a message dated 9/5/01 9:23:19 PM, [EMAIL PROTECTED] writes:
>
><< An OOP question.
>
>In Flash you can create new properties of an object on the fly. Is it
>possible with Director. I am attempting to add globals to the globals,
>which I have found to have an ilk of #instance. So it seems that all one
>would have to do is append a new property of the globals object instance.
>Since it is not a list one can not just AddProp. I am trying to create a
>tutorial for programming that allows users to define variables. But since I
>want to allow them to manipulate them over time, it needs to be global as
>opposed to local.
>
--
Lingo / Director / Shockwave development for all occasions.
(Home-made Lingo cooked up fresh every day just for you.)
[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!]