Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
| 1 | To indicate that a symbol from the library can be controlled with ActionScript, you need to set its linkage properties to Export For ActionScript. |
| 2 | The basic syntax to use a for loop is:
for (var i:int = 0; i< someNumber; i++) {
doSomething();
} |
| 3 | To check for more than one condition in an if statement, you can use the syntax else if with additional conditions after the closing brace of the first condition, as in this example:
if (a == true) {
doSomething();
} else if (b == true) {
doSomethingElse();
} |
| 4 | The hitTestObject() method is used to determine if the bounding box of one object is intersecting with another. For example, to see whether a MovieClip instance named ship1 had contact with a MovieClip instance named baseStation, you could write:
if(ship1.hitTestObject(baseStation){
doSomething();
} |
| 5 | Array is a class that can be used to store a list of objects. An instance of an array can be created and stored in a variable like any other ActionScript data type, as in this example:
var employeeList:Array = new Array(); |
| 6 | The push() method of the Array class can be used to add a new element to the next available location in an array, as in this example:
employeeList.push("John Smith"); |
| 7 | Keeping in mind that the elements in an array are counted beginning with 0, the first element in an array named cars can be identified as cars[0]. |