Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Lingo (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Features== Lingo is embedded into Adobe Director, and can be added as scripts on objects or on the timeline. Lingo is an [[object-oriented programming]] (OOP) language, and supports [[Smalltalk]]-like verbose syntax, OO dot syntax, and inheritance. ===Verbose syntax=== When Lingo was created, a verbose syntax was designed to mimic spoken language, so it would be easy for new users. Users could write [[HyperTalk]]-like sentences such as: <syntaxhighlight lang="applescript"> if the visibility of sprite 5 then go to the frame </syntaxhighlight> In ''go to'' statements, the "to" is optional, and unlike other programming languages, ''go'' statements reference frames in Director's Score, not specific code lines. Lingo was also initially very robust by providing object generation through a notion called <code>factory</code>, which led to the language's extensibility through External Factories (XFactories) or XObjects. For Director 3.13 and later versions, extensibility occurred via a different type of plug-in called an XTRA, based upon the Microsoft Component Object Model (COM). ===Dot syntax=== Although it is still possible to use the verbose syntax, the current version of the language fully supports OO dot syntax, so that the code looks more like standard programming languages such as [[JavaScript]] or [[C++]]. The equivalent in new scripting style would be: <syntaxhighlight lang="applescript"> if sprite(5).visible then _movie.go(_movie.frame) </syntaxhighlight> This format uses elements of the Director Object Model, introduced in Director MX 2004. The syntax in prior versions would be like: <syntaxhighlight lang="applescript"> if sprite(5).visible then go the frame </syntaxhighlight> ===Scripting=== There are 4 types of Lingo scripts in Director, each with a specific purpose. Each type of script may be added to certain types of compatible objects. *''Cast'' scripts work only with their member, not all events can be used with them. *''Behavior'' scripts are attached to a sprite or inserted into a frame. Sprite behaviors are often used to give control of the sprite's properties and movement. Frame behaviors can be used to create a pause or delay within a certain frame in the score. Behaviors make it easy to program in an object-oriented way, as you can directly see the relationship between the programming and the item they are attached to. They can also control or interact with other sprites, making them a true object. *''Movie'' scripts are not attached to sprites nor can they be instantiated as Objects. They are available throughout the program (movie) and are especially useful for holding global handlers and initializing global variables at the start or end of the movie. *''Parent'' scripts are used to ''birth'' (create instances of) an object into a variable using the ''new'' command. These objects can control sprites and other media remotely, without being attached to any one sprite, may be used to control data or other non-displayed items, and are useful for recursion routines such as pathfinding. A Parent script can be used to create or destroy an object at any time, freeing them from the confines of the score that a Behavior is limited to. Behavior and parent scripts encourage good object-oriented programming. Movie scripts are not as OOP-oriented. However, they can still be used to make ''black-box'' handlers, where other objects can input raw data and receive answers back, without knowing the inner workings of the box. Using the strengths and ease-of-use of Director's programming methodology, with the advantages of OOP makes for a powerful and fast programming environment. ===Inheritance === Lingo supports object [[Inheritance (object-oriented programming)|inheritance]] by a slightly idiosyncratic system: a script can have an <code>ancestor</code> property which references another object (usually also a script, although other objects such as cast members can also be ancestors). Properties and methods of the ancestor are inherited by the parent. Behavior scripts are also a kind of ancestor of the sprites to which they are attached, since properties and methods of the behavior can be accessed by reference to the sprite itself. In this case, it is a kind of [[multiple inheritance]], as one sprite may have several behaviors.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)