Essential ActionScript 3.0, First Edition by Colin Moock The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated May 13, 2008. Safari - 22.4. Text-Input Events first paragraph; "Example 22-4" should read: "Table 22-4" Link also should be corrected. {N/A} 22.3. Keyboard-Input Events 2nd paragraph; "Example 22-3" should read: "Table 22-3" Link also should be corrected. [6] 1st paragraph; Original sentence is: "The latter form of compilation is know as just-in-time compilation, or JIT, because it happens immediately before the specific bytecode being compiled is needed by the program." It should be: "because it happens immediately after..." (48) 3rd line on page (equals 3rd line of printed code); greeting = "Guten tag"; should be: greeting = "Guten Tag"; {59} 4th example; The code snippet is: if (xPosition < 0 || xPosition >100) { //This code executes if xPosition is between Isn't the comment wrong? Doesn't the code execute if xPosition is leass than 0 or greater than 100 (in other words NOT between?) (78/79) final para / example 4.1; it says "Changes since previous version are shown in bold" where example 4-1 on page 78 shows changes in bold, the changes on pages 79 are not in bold which does make it harder to see all of them (83) 3rd paragraph; The second sentence says "First, a class method cannot use the this keyword." I believe it should read, "First, a static method cannot use the this keyword." as this sentence is referring to limitations of static methods as compared to instance methods. [89] 3rd and 4th Paragraph; I could be wrong, but I spent all afternoon workingon it. In you your example of accessing a function outside of a package, you say you can access it by "importing" the function. But since importing seems to be only for classes, not for functions. I could never access the function outside the package due to the fact the import stuff didn't work. [102] Chapter:6 6.1. A Primer on Inheritance var bInstance:B = new B( ); should read var bInstance = new B( ); IF "var bInstance:B = new B( );" is correct, writer should explain the usage of ":B {105} Bottom Tip Box; forgive me if I am wrong, but in AS3, I do not believe you can override -> Private <- access-control modifiers. If the superclass and subclass method is Private, AS3 will throw a compile time error "1020:Method marked override must override another method." The text: "An override attempt succeeds only if the the overriding version of the method has the same name, -> access-control modifier <- , parameter list, and return type as..." {113} First paragraph; Change from: "Because class m()..." To: "Because method m()..." {130} 1st paragraph; On page 130 we are told that the virtualzoo program resides in a folder structure /virtualzoo/src/. However, I believe it should be /virtualzoo/src/zoo. If you refer back to the bottom of page 10 the author states that a file that contains a package named zoo must reside in a folder named zoo. See the file structure at the top of page 11 {132} Running the program 2.; "Select Run -> Debug Virtual Zoo" should be "Select Run -> Debug As -> Flex Application" (at least in Flex 2.0.1) (134) last para; "When the .swf is exported" is the language of the Flash IDE. For Flex Builder you might say "During the build". For mxmlc you might say "During compilation" which is probably the most tool-independent way of saying this. [154] Example 8.1 The VirtualZoo class; No explanation to why the VirtualZoo class is now defined in an unnamed package - thus meaning the file location of this main programme point of entry has changed from the previous examples... this example is only about adding type annotations so cannot understand why the structure has changed... Also, because of the above, the VirtualPet class access control modifier has been changed to public... which is different to earlier examples... (and with no explanation to why it has changed) (162) The section is "Interface Syntax and Use", first code block and the paragraph after it; interface Somename should be SomeInterface {197} final bullet point; in the removing elements from the array the final bullet says: "invoke push(), unshift(), or splice()" when I think it should say "Invoke pop(), shift(), or splice()" [207-208] Bottom of 207 to the top of 208; I reproduced the code here into an .as file and then instantiated a ResizeMonitor object in flash. But it threw the following error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at ResizeMonitor$iinit() at fileLoader_fla::MainTimeline/fileLoader_fla::frame1() After a bit of testing I found that the stage object returns null inside of a class but once I passed a reference to it as an argument into the ResizeMonitor class it works fine: var myResizer:ResizeMonitor = new ResizeMonitor(stage); and then the class would be changed to this: public function ResizeMonitor(stage:Stage){ ... } (207) private function ioErrorListener(e:Event):void; I had expected the eventObject returned to the ioErrorListener function to be typed (e:IOErrorEvent_EVENT), and not (e:Event). private function ioErrorListener(e:IOErrorEvent_EVENT):void (213) Very bottom of the page; There is a line at the bottom of page 213 that reads as follows. t.type = TextFieldType.INPUT The above line forgets to terminate with a semi colon as required by the compiler, other wise you'll get an error. (222) text in the first tip at the top of the page; Should the line: To target an event dispatch at an instance of a class that already extends a class another, ... be changed to something like: To target an event dispatch at an instance of a class that already extends another class, ... (301) 2nd major paragraph; Last sentence, starting with, "Quite a lot of work..." has a misplaced apostrophe. The apostrophe on ol' should follow the L, not precede the O. The apostrophe is standing in the place of a missing letter. So altogether, it should read: ...lot of work for li'l ol' a! {493} private function addedListener; The code on this page was: if (DisplayObject(e.target.parent) == e.currentTarget) shouldn't it be: if (DisplayObject(e.target).parent) == e.currentTarget) {496} - Safari - 20.3.3.1. Custom Event.ADDED_TO_STAGE and Event.REMOVED_FROM_STAGE events; Example 20-8 not working. Exits with the error: "5000: The class 'StageDetector' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type." [500] Example 20-10; It says every class in the display API can be extended. But textfield is in the flash.text and not flash.display list. I`m not sure because i`m new to AS 3.0 but this example doesn`t work for me. {500} Example 20-10; I found that html = true caused a 1120 error ("Access of undefined property html"). I remember that html was a property of the TextField class in AS2, but when I looked it up on LiveDocs, I found that it is missing from the public properties of this class in AS 3.0. Is this correct? (537) Second code frag; The closing brace of clickListener() is incorrectly aligned [549] Second last paragraph; original text: Objects with _visible set to false are automatically excluded from the tab order. Shouldn't it be changed to: Objects with visible set to false are automatically excluded from the tab order. since the _visible property has been renamed to visible? (561) private function keyDownlistener; The differentiation between LEFT and RIGHT never seems to occur... "e.keyLocation" always shows up as "0" in the Output window. import flash.ui.Keyboard; import flash.ui.KeyLocation; ... private function keyDownListener (e:KeyboardEvent):void { if (e.keyCode == Keyboard.SHIFT) { if (e.keyLocation == KeyLocation.LEFT) { trace("The right LEFT key was pressed"); } else if (e.keyLocation == KeyLocation.RIGHT) { trace("The right SHIFT key was pressed"); } } } {564} Second para; String.fromCharCode() is a static method so "String class's instance method fromCharCode()" should be "String class's static method fromCharCode()" {602} 1st prose paragraph; after the semicolon on line 6, in the following text: "it simply invokes draw() every time getWidth(), getHeight(), or the Ellipse constructor method is executed." the names "getWidth(), getHeight()" should be changed to "setWidth(), setHeight()" (change "g" to "s" in two places) [606] In function titled: removedFromStageListener; in the function removedFromStageListener, the line: stage.addEventListener(Event.RENDER, renderListener); should be: stage.removeEventListener(Event.RENDER, renderListener); [608] Last paragraph; Example 23-5:The final, optimized ellipse class, method 'renderListener': Shouldn't here (or maybe in the 'draw' method) a call to the method 'clearChanged' be added? In the current code 'hasChanged' always evaluates to true, even directly after a rendering. That's not right. [609] 1st paragraph; It looks like 'clearChanged()' is never called in the render listener, thus making all subsequent calls to 'draw()' happen, even if the ellipse hasn't changed. [613] moveTextRight function; This logic error is repeated throughout the chapter (chapter 24). The code is supposed to remove the eventListener when the textField has reached the proper position (x = 300). The conditional test will NEVER fall through to the "else" statement because the position t.x is reset so it will always satisfy the first "if" statement. Two way to fix this: 1. original: if (t.x <= 300) { to: if (t.x < 300) { 2. a cleaner solution would be to rewrite the function as: public function moveTextRight (e:Event):void { t.x += 10; if (t.x >= 300) { t.x = 300; // stop listening for the Event.ENTER_FRAME event removeEventListener (Event.ENTER_FRAME, moveTextRight); } } [626] AnimationLibDemo class; Missing in the AnimationLibDemo class: import flash.geom.*; A Point Instance is created in the class but the class was never imported. Compiler will yield error. {631} Top of page, first code example; To set the line style to 2 pixel and 50% transparent green the code should be ... lineStyle(2, 0x00FF00, 0.5); not ... lineStyle(2, 0x00FF00, 50); since transparency is between 0.0 and 1.0 in AS3. [671] Example 26-7; A new Matrix object is stored in the identifier matrixScale: var matrixScale:Matrix = new Matrix(); In the next lines the identifier has changed to matrix and results in an error: matrix.scale(scaleFactor, scaleFactor); scaledBitmapData.draw(originalBitmapData, matrix); {702-703} Figures 27-6 & 27-7; The figures don't show text field word wrapping & expansion as I'm seeing it in my tests. When I turn on word wrapping, none of the text is truncated--as shown in Fig. 27-6. And when I use the TextFieldAutoSize.LEFT/CENTER options the text field (using the code in Example 27-3) is not truncated as shown in Fig. 27-7. {829} 4th para; This para says "Code in a frame script of the main timeline executes in its own scope, with the same set of access rules applied to instance methods of the document class". This is, at best, misleading. In fact, "var" declarations in a frame script of the main timeline have instance scope (and are not "in its own scope"). (842) last para; This section says "we can refer to the star instances from sky.fla's main timeline directly by instance name" and "we can also refer to the star instances directly by instance name" but later in the same chapter (p848) you distinguish between access by instance name (where getChildByName() is used) and by reference. In which case this section should say "we can refer to the star instances from sky.fla's main timeline directly by reference". {849} second para; I'm not sure what this para is trying to say but it seems to imply that the MXML id attribute isn't an ActionScript reference. In fact the MXML compiler pre-compiles the id attribute into exactly that. Hence for example you can refer to a variable declared declaratively in MXML as follows:- using the ActionScript reference, as follows... fred = "Hello"; The same is true for instances of the UIComponent class such as that are added as children to the display list. They can also be referred to using the id attribute as a reference, as follows... jane.label = "Click me"; (859) data grid at bottom of page; You need to move the datagrid because it covers the "Click Quickly!" button. e.g. grid.x=200 Also, the example code on your site is for the previous example from page 858-- this should be corrected. {878} line immediately following the comment "// Constructor"; this code: public function VirtualPet (name:String):void { should read: public function VirtualPet (name:String) { (remove ":void") [901] Alphabetically; According to the index, there is no mention of the statement "include" in the book (it is the same as AS2 "#include", but with slightly different syntax). I've looked through the book myself, and also haven't been able to find a mention, so this seems to be more than an indexing omission. This is an important statement, so it should be mentioned.