Using Director > Parent Scripts > Writing a parent script > Using the me variable |
![]() ![]() ![]() |
Using the me variable
Typically, one parent script creates many child objects, and each child object contains more than one handler. The term me
is a special parameter variable. It must always be the first parameter variable stated in every handler definition in a parent script.
The me
variable tells the handlers in the child object that they are to operate on the properties of that object and not on the properties of any other child object. This way, when a handler within a child object refers to properties, the handler will use its own child object's values for those properties.
This is why it is always important to define me
as the first parameter for parent scripts and to pass the same parameter if you need to call other handlers in the same parent script, since these will be the handlers in each of the script's child objects.
When referring to properties defined in ancestor scripts, you must use the me
parameter as the source of the reference. This is because the property, while defined in the ancestor script, is nevertheless a property of the child object. For example, these statements both use me
to refer to an object and access properties defined in an ancestor of the object:
--access ancestor property x = me.y
or
x = the y of me
Because the me
variable is present in each handler of the child object, it indicates that all the handlers control that same child object.
See me
.
![]() ![]() ![]() |