call
251
The following example shows how a
call
statement can call handlers in a behavior or parent
script and its ancestor.
•
This is the parent script:
-- Lingo syntax
-- script Man
property ancestor
on new me
set ancestor = new(script "Animal", 2)
return me
end
on run me, newTool
put "Man running with "&the legCount of me&" legs"
end
•
This is the ancestor script:
-- script Animal
property legCount
on new me, newLegCount
set legCount = newLegCount
return me
end
on run me
put "Animal running with "& legCount &" legs"
end
on walk me
put "Animal walking with "& legCount &" legs"
end
•
The following statements use the parent script and ancestor script.
This statement creates an instance of the parent script:
set m = new(script "man")
This statement makes the man walk:
call #walk, m
-- "Animal walking with 2 legs"
This statement makes the man run:
set msg = #run
call msg, m
-- "Man running with 2 legs and rock"
This statement creates a second instance of the parent script:
set m2 = new(script "man")
This statement sends a message to both instances of the parent script:
call msg, [m, m2]
-- "Man running with 2 legs "
-- "Man running with 2 legs "
Содержание DIRECTOR MX 2004-DIRECTOR SCRIPTING
Страница 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Страница 48: ...48 Chapter 2 Director Scripting Essentials...
Страница 100: ...100 Chapter 4 Debugging Scripts in Director...
Страница 118: ...118 Chapter 5 Director Core Objects...
Страница 594: ...594 Chapter 12 Methods...
Страница 684: ...684 Chapter 14 Properties See also DVD...
Страница 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Страница 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Страница 889: ...netPresent 889 _player alert Sorry the Network Support Xtras could not be found See also Player...
Страница 1102: ...1102 Chapter 14 Properties...