Chapter 3
72
The ancestor script can contain independent property variables that can be obtained by child
objects. To refer to property variables within the ancestor script, you must use this syntax:
me.
propertyVariable =
value
For example, this statement changes the property variable
legCount
within an ancestor script to 4:
me.legCount = 4
Use the syntax
the
variableName
of
scriptName
to access property variables that are not
contained within the current object. This statement allows the variable
myLegCount
within the
child object to access the property variable
legCount
within the ancestor script:
set myLegCount to the legCount of me
Example
Each of the following scripts is a cast member. The ancestor script Animal and the parent scripts
Dog and Man interact with one another to define objects.
The first script, Dog, sets the property variable
breed
to Mutt, sets
the
ancestor of Dog
to the
Animal script, and sets the
legCount
variable that is stored in the ancestor script to 4:
property breed, ancestor
on new me
set breed = "Mutt"
set the ancestor of me to new(script "Animal")
set the legCount of me to 4
return me
end
The second script, Man, sets the property variable
race
to Caucasian, sets
the ancestor of Man
to the Animal script, and sets the
legCount
variable that is stored in the ancestor script to 2:
property race, ancestor
on new me
set race to "Caucasian"
set the ancestor of me to new(script "Animal")
set the legCount of me to 2
return me
end
See also
new()
,
me
,
property
and
Syntax
logicalExpression1
and
logicalExpression2
Description
Logical operator; determines whether both
logicalExpression1
and
logicalExpression2
are
TRUE
(1), or whether either or both expressions are
FALSE
(0).
The precedence level of this logical operator is 4.
Examples
This statement determines whether both logical expressions are
TRUE
and displays the result in the
Message window:
put 1 < 2 and 2 < 3
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...