Using Director > Parent Scripts > Parent scripts overview |
![]() |
Parent scripts overview
Parent scripts provide the advantages of object-oriented programming within Director. These advantages include the ability to write less code and use simpler logic to accomplish tasks in Lingo. You can use parent scripts to generate script objects that behave and respond similarly yet can still operate independently of each other.
Lingo can create multiple copies (or instances) of a parent script. Each instance of a parent script is called a child object. You can create child objects on demand as the movie plays. Director doesn't limit the number of child objects that can be created from the same parent script. You can create as many child objects as the computer's memory can support.
Director can create multiple child objects from the same parent script, just as Director can create multiple instances of a behavior for different sprites. You can think of a parent script as a template and of child scripts as implementations of the parent template.
This chapter describes the basics of how to write parent scripts, and create and use child objects, and it provides script examples. It doesn't teach fundamental object-oriented programming concepts; however, to use parent scripts and child objects successfully, you must understand object-oriented programming principles. For an introduction to the basics of object-oriented programming, see one of the many third-party books on that subject.
![]() |