Chapter 1. How Lingo Thinks

So You’re Too Busy to Learn Lingo

Do you really have time to read a book on Lingo when you’re facing a deadline? The answer depends on how much time you waste struggling with Lingo and how often you’ve compromised your Director projects for lack of Lingo skills. If you make the investment now, this book will pay marvelous dividends. It may save you weeks otherwise spent flailing over relatively trivial Lingo problems, and it can help you to add snazzy new features and a professional polish to your Director projects.

Tip

If you don’t have a project to work on, pick one now. You will learn much more if you have a concrete goal and concrete problems to solve. You have been warned.

Learning to program is a process, not an event. Although this book is not a substitute for an introductory programming class, it covers basic, intermediate, and advanced topics. The material is very condensed, but the book also lavishes attention on topics that are omitted entirely from other Lingo books. Before proceeding, you should understand Director’s Cast, Score, and media editing windows, as covered in Macromedia’s Using Director manual. You might also want to skim Macromedia’s Learning Lingo manual for a broad overview of Lingo.

Most books provide simple examples that leave you stranded when you try to accomplish your specific goals. This book teaches you how to do anything you want with Lingo, not just create simple clickable buttons. It provides a solid foundation instead of a house of cards, and it is for people who want to know more, not less. As such, this book explores many abstract concepts that may not be relevant to your immediate needs. You must exercise reasonable discretion by ignoring topics that don’t interest you or are beyond your current level.

This chapter lays the groundwork for your Lingo-laden future, but the details of using Lingo to add interactivity are in later chapters (starting with Chapter 2, Events, Messages, and Scripts). You should first focus on understanding how Lingo itself “thinks.” Lingo is a marathon, not a sprint, and the extra training will pay off in the long run. More practical examples are given in Chapter 9, Mouse Events, and Chapter 10, Keyboard Events. Refer to the companion book, Director in a Nutshell, for details on using Lingo to control and analyze cast members, sprites, sounds, digital video, MIAWs, fields, and memory.

You are not expected to understand the entirety of this book the first time you read it. Much of it will be meaningless until you’ve worked with Lingo for a few months and encountered specific problems that you wish to solve. At that time, you will recall enough to know what sections you need to reread. As in the film The Karate Kid, what may seem like meaningless manual labor is really your first step toward a black belt in Lingo. You should revisit this and other chapters periodically. They will reveal additional nuggets of knowledge as your experience and problems with Director and Lingo grow. Certainly, you should return to the appropriate chapter whenever you encounter a vexing problem, as the chances are high that the answer lies herein.

Even if Lingo is your first programming language, this chapter will help you to understand other people’s Lingo code (which is the first step in creating your own). This chapter unavoidably introduces many new concepts that depend on other material not introduced until later (the old “chicken and the egg” problem). Skip around the chapter as necessary, and consult the Glossary whenever you feel queasy. Keep in mind that this chapter is intended to satisfy a broad range of users, some with much more programming experience than others. Skip the mind-numbing sections that don’t have relevance for you yet (but revisit them later). Above all, do not lose heart. If you keep reading, you’ll encounter the same concepts again, and they will eventually make sense. In the words of Owl, “Be brave, little Piglet. Chin up and all that sort of thing.”

The example code used throughout this book is available from the download site cited in the Preface, but you should create a test Director movie file and type in the shorter examples by hand. Add the examples in each chapter to your test movie and use it like a lab notebook full of your experiments. This practice will make it much easier to write your own Lingo when the time comes. You might want to maintain a separate test movie for each chapter; start with a fresh movie (to eliminate potential conflicts) if an example doesn’t seem to work.

Tip

You must abandon the safety of spoon-fed examples and experiment. If at first you don’t fail, try, try again. You will learn more from failure than from success.

Experienced programmers can skim most of this chapter but should read the sections entitled "Recursion,” "Dynamic Script Creation,” "The Classic Three-Line If Statement,” "Special Treatment of the First Argument Passed,” and "Variable-Length Parameter Lists.” Also see Chapter 4, Lingo Internals.

Let us set our goals high and see if we can stretch our minds to reach them. Let us now commit ourselves not only to learning Lingo, but also to becoming true Linguists, as fluent in Lingo as we are in our own native tongues.

Like all experienced Linguists, you should first build a shrine to the Lingo Gods with an altar for burning incense to summon and appease them. Abandon all hope, ye who enter here, for there is no turning back.

“Do or not do. There is no try.”—Yoda

Get Lingo in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.