Beginning ActionScript 2.0 2006
.pdfA
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
a.Valid. It is a combination of a declaration and an assignment, which is allowed in a single statement.
b.Not valid. The data type Integer does not exist. The Number data type should be used instead.
c.Not valid. Strong typing requires use of the var statement.
d.Not valid. A variable name cannot start with a number.
e.Valid, but not recommended. The variable name is also used as a property for the MovieClip class.
f.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.