Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Review answers

1To indicate that a symbol from the library can be controlled with ActionScript, you need to set its linkage properties to Export For ActionScript.
2The basic syntax to use a for loop is:
for (var i:int = 0; i< someNumber; i++) {
 doSomething();
}

3To 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();
}

4The 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();
}

5Array 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();

6The 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");

7Keeping 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].


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial