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:
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.
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.