Behaviors
371
Using inheritance in behaviors
Behaviors can have ancestor scripts in the same way that parent scripts do. (Ancestor scripts are
additional scripts whose handlers and properties a parent script can call on and use.)
•
The ancestor’s handlers and properties are available to the behavior.
•
If a behavior has the same handler or property as an ancestor script, Lingo uses the property or
handler in the behavior instead of the one in the ancestor.
For more information about the concept of ancestors and inheritance, see “Using parent scripts
and child objects” on page 417.
To make a script an ancestor, do one of the following:
•
Declare that
ancestor
is a property in the
property
statement at the beginning of the
behavior’s Score script.
For example, the statement
property ancestor
declares that
ancestor
is a property.
•
Include a statement that specifies which script is the ancestor. Put the statement in an
on
beginSprite
handler in the behavior.
For example, this handler makes the script Common Behavior an ancestor of the behavior
when Director first enters the sprite:
on beginSprite
set the ancestor of me to new (script "Common Behavior")
end
This handler will let the behavior also use the handler in the script Common Behavior.
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...