Using Director > Parent Scripts > Writing a parent script > Adding other handlers |
![]() ![]() ![]() |
Adding other handlers
You determine a child object's behavior by including in the parent script the handlers that produce the desired behavior. For example, you could add a handler to the code above to make the sprite change color.
The following parent script defines a value for the property spriteNum
and contains a second handler that will change the forecolor
property of the sprite.
property spriteNum on new me, aSpriteNum spriteNum = aSpriteNum return me end on changeColor me spriteNum.forecolor = random(255) end
![]() ![]() ![]() |