Don’t get me wrong, ActionScript 3.0 CookBook is damn good, and one of the few AS3 books published to-date. However it is a first edition and does contain errata – probably due to having been written against an alpha or early beta version of Flex2 / AS3. I reported those I had found to O’Reilly some weeks ago, but at time of writing this article they have yet to be published to the errata page.
In future any significant errata I beleive I have found in any book (where the publisher has yet to make them available) I will report on this blog under the tag errata so anyone wondering why certain things don’t work, stands a chance of finding them with a Google.
1. Incorrect description of graphics.lineStyle()
This error is present throughout chapter 7. On page 182 the thickness parameter is described as having a default value of 1. Throughout chapter 7 code samples use the line:
sampleSprite.graphics.lineStyle()
I believe this line should read:
sampleSprite.graphics.lineStyle( 1 )
As from the Adobe documentation:
thickness:Number — An integer that indicates the thickness of the line in points; valid values are 0 to 255. If a number is not specified, or if the parameter is undefined, a line is not drawn.
Therefore using lineStyle as presented in as3cb will result in no line being drawn where a line of 1px thickness was intended.
2. doubleClick description
Not really errata, but the following would have benefited from one crucial extra piece of information:
Page 169, the description of doubleClick.
Generated when the user presses and releases the mouse button twice in rapid succession over the interactive display object
The above quote is true, as long as the developer has previously set the doubleClickEnabled property of the interactive display object to true. If not, no doubleClick event is fired. Considering the target audience of this book – quite an important point to mention.
3. ColorTransform
Pages 76 and 77
With regards to the ColorTransform instances, the code samples make reference to an ‘rgb’ property. No such property exists. The property the author is intending is ‘color’ which returns an rgb value represented in type uint.
Page 396
Incorrect:
import flash.display.TextField;
import flash.display.TextFieldAutoSize;
Correct:
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
I submitted this to O’Reilly already.
Good spot! And still the O’Reilly page claims no errata. How long should it take for these to filter through?
Page 4
Original:
[SWF(width=”800″, height=”600″, backgroundColor=”#ffffff”, frameRate=”31″)]
This line is placed inside the main package block, but outside any class definitions (usually just before or after any import statements).
Correction:
[SWF(width=”800″, height=”600″, backgroundColor=”#ffffff”, frameRate=”31″)]
This line is placed inside the main package block, but outside any class definitions (usually just after any import statements).
The changed text is the removal of “before or”, as it MUST be placed after any import statements.
Update: The errata listed here are now included in the unconfirmed list on the O’Reilly site http://www.oreilly.com/catalog/actscpt3ckbk/errata/actscpt3ckbk.unconfirmed