Using Director > Parent Scripts > Writing a parent script > Creating the on new handler |
![]() ![]() ![]() |
Creating the on new handler
Each parent script typically uses an on new
handler. This handler creates the new child object when another script issues a new(script
parentScriptName
)
command, which tells the specified parent script to create a child object from itself. The on new
handler in the parent script can also set the child object's initial property values, if you want. The on new
handler always starts with the phrase on new
, followed by the me
variable and any arguments being passed to the new child object. See new()
.
The following is a sample on new
handler:
property spriteNum on new me, aSpriteNum spriteNum = aSpriteNum return me end
![]() ![]() ![]() |