Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 228

Every object should be named. An object that has a name can be referenced and controlled with ActionScript. Buttons on the Stage are referred to as instances, and in fact, instances and objects are synonymous. Methods Methods are commands that result in action. Methods are the doers of ActionScript, and each kind of object has its own set of methods. Understanding ActionScript involves learning the methods for each kind of object. For example, two methods associated with a MovieClip object are stop() and gotoAndPlay() . Properties Properties describe an object. For example, the properties of a movie clip include its height and width, x and y coordinates, and horizontal and vertical scale. Many properties can be changed, whereas other properties can only be “read,” meaning they simply describe an object. Using proper scripting syntax If you’re unfamiliar with program code or scripting, you may find ActionScript code challenging to decipher. Once you understand the basic syntax, which is the grammar and punctuation of the language, you’ll find it easier to follow a script. • The semicolon at the end of the line tells ActionScript that it has reached the end of the code line. • As in English, every open parenthesis must have a corresponding close parenthesis, and the same is true for brackets and curly brackets. If you open something, you must close it. Very often, the curly brackets in ActionScript code will be separated on different lines. This makes it easier to read what’s inside the curly brackets. • The dot operator (.) provides a way to access the properties and methods of an object. Type the instance name, followed by a dot, and then the name of the property or method. Think of the dot as a way to separate objects, methods, and properties. • Whenever you’re entering a string, use quotation marks. • You can add comments to remind you or others of what you are accomplishing with different parts of the script. To add a comment for a single line, start it with two slashes ( // ). To type a multiline comment, start it with /* and end it with */ . Comments are ignored by Flash and won’t affect your code at all. Adobe FLAsh ProFessIonAL Cs6 CLAssroom In A book 219