Appendix A. Exercise Answers

Chapter 1

There are no actual solutions to the exercises in Chapter 1, which were created simply to help you become accustomed to the Flash IDE, where you'll be spending quite a bit of time as you work through this book.

Chapter 2

Exercise 1 Solution

  1. Valid. It is a combination of a declaration and an assignment, which is allowed in a single statement.

  2. Not valid. The data type Integer does not exist. The Number data type should be used instead.

  3. Not valid. Strong typing requires use of the var statement.

  4. Not valid. A variable name cannot start with a number.

  5. Valid, but not recommended. The variable name is also used as a property for the MovieClip class.

  6. Not valid. Data of type String is being assigned to a variable of type Boolean. The quotes should be removed.

Exercise 2 Solution

The contents of the round brackets are evaluated first, so numItemsPrepaid is subtracted from numItemsPickedUp. Next, the multiplication is evaluated, with the results of the subtraction multiplied by perItemCost. That result is then added to handlingFee, and that final answer is assigned to totalAmount.

Exercise 3 Solution

The final value is 130.

Exercise 4 Solution

The output is

blue jay-crow-warbler

Chapter 3

Exercise 1 Solution

var shoppingCart:Array = new Array();
shoppingCart.push({modelNumber:"ip300", description:"MP3 Music Player", 
Exercise Answers
price:299, quantity:1}); shoppingCart.push({modelNumber:"ip300c", ...

Get Beginning ActionScript 2.0 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.