ActionScript 3.0 Design Patterns, First Edition by William B. Sanders, Chandima Cumaranatunge 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 14, 2008. [3] chapter 3 - singleton - (errata submission part 2 - the fix); Fix for the submission re: Section 3.2.1 - singleton error: PublicClass.as Line 18, close the brace "}", effectively removing the 'constructor' functionality - but this code as printed has an error - not enough closing braces. This fixes that. [8] First paragraph; it says : "4. Select Insert -> New Symbol from the menu bar to open the Convert to Symbol Dialog box." No such thing exsist. Insert -> New Symbol creates a new Symbol. To convert to symbol : Modify -> Convert to Symbol. {9 on Safari} chapter 1.9. Favor Composition - 3rd paragraph; Composition includes a reference to another class in a class definition. Example 1-45 shows how a class is set up to use composition. The line The correct is: ... "Example 1-43" shows how ... [10] 2nd paragraph; "You can no longer attach a class to a movie clip as was the case in previous versions." This is not correct. In the example in this section, you could create a class named FireRocket which would automatically be associated with that movie clip (as long as the class file was placed in the fla's classpath). (19) figure 1-5. Objects signature; figure 1-5 appears to show a function signature. The caption and surrounding text refer to objects' signatures. Also, the text above figure 1-5 on page 19, reads: "An object's signature is it's operation name, parameters, and return data type". I don't think objects have return data types in this language. It looks to me like the word "object" was used where "function" would have made sense, a few times on this page. (38-39) Example 1-33. file Plasma.as in 1.6. Polymorphism chapter; This is not a error at all but any other people can have the same troubles i did. I got some problems testing the exercise "1.6.2. Implementing Polymorphism with Interfaces" I have used my own FLV catched on the web file to test the app and i got the Follow error on the file "Plasma.as". Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=ReferenceError: Error #1069: Property onMetaData not found on flash.net.NetStream and there is no default value. at Plasma/productDisplay() at DoBusiness$iinit() By reference in Adobe documents, AsyncErrorEvent is Dispatched when an exception is thrown asynchronously, from native asynchronous code. This event is dispatched when a server calls a method on the client that is not defined. This happened because my FLV file on test embedded properties inside it and the Plash Player 9 has dispatched the event onMetaData but that event was not defined on the class Plasma.as. To avoid this problem I sugest use one clear FLV or change the code a bit as follow: private var nc:NetConnection; private var flvFile:String; public function productDisplay(flv:String):void { nc = new NetConnection(); nc.addEventListener(NetStatusEvent.NET_STATUS,onStatus); //play when onStatus.info is filled nc.connect(null); } /*Dispatched when a NetConnection object is reporting its status or error condition, in this case connection success.*/ private function onStatus(e:NetStatusEvent):void { if (e.info.code == "NetConnection.Connect.Success") { ns=new NetStream(nc); /* To implement this event cannot use the addEventListener here look in Adobe documents to find another valid way extending the class I have used this way here to be simple on the solution */ var obj:Object = new Object(); obj.onMetaData = onMetaDataEvent; ns.client = objMeta; ns.play(flvFile); vid= new Video(); vid.attachNetStream(ns); addChild(vid); } } /*Dispatched when Flash Player receives descriptive information embedded in the FLV file being played.*/ private function onMetaDataEvent(obj:Object):void { trace("properties found in FLV"); for (var str:String in obj) { trace(str+":"+ obj[str]); } } Another way to solve this is extends the class NetStream and use that on the Plasma.as: //Plasma.as private var nc:NetConnection; private var flvFile:String; public function productDisplay(flv:String):void { flvFile = flv; nc = new NetConnection(); nc.addEventListener(NetStatusEvent.NET_STATUS,onStatus); nc.connect(null); } /*Dispatched when a NetConnection object is reporting its status or error condition, in this case connection success.*/ private function onStatus(e:NetStatusEvent):void { if (e.info.code == "NetConnection.Connect.Success") { ns=new NetStreamCustom(nc); //using our subclass 'NetStreamCustom' ns.play(flvFile); vid= new Video(); vid.attachNetStream(ns); addChild(vid); } } Later write a subclass to extend the NetStream class: //NetStreamCustom.as package { import flash.net.NetStream; import flash.net.NetConnection; public class NetStreamCustom extends NetStream { public function NetStreamCustom(nc:NetConnection):void { super(nc); } /*Dispatched when Flash Player receives descriptive information embedded in the FLV file being played.*/ public function onMetaData(obj:Object):void { trace("properties found in FLV"); for (var str:String in obj) { trace(str+":"+ obj[str]); } } } } (60) 2nd paragraph; "(or the client for that manner)" should most likely be changed to read "(or the client for that matter)" (67) bottom; The code example shows incorrect capitalisation, suggesting that FactoryMethod is a class. The code example should look like: operation() { .. product = factoryMethod(); .. } [72] First paragraph under "Clients" heading; "The document class Main is the client ... In Example 2-7, the document class calls a static method called run() in the static Test class to run some tests." No static method is called from within the example. No Test class exists in the example. I assume a second class called Test is meant to be shown in the Main.as file, in example 2-7? [73] First paragraph under "Hiding the Product Classes" heading; "Add the following statements to the Test class" No Test class exists in the example. (80) Example 2-16; The trace statement should read, "to color inkjet printer", not "to color LASER printer" (emphasis mine) as it does currently. (83) Figure 2-7; In the diagram there's a duplicate of the classes InkjetPrintJob and ColorInkjetPrintJob where WorkgroupPrintJob and ColorLaserPrintJob should be. (85) 3rd paragraph, bottom of page; Under the heading Product Classes: Shape Widgets it reads "Unlike in previous examples, we define ShapeWidget as an abstract interface" it should read "... we define ShapeWidget as an abstract class". [104] The entire singleton pattern section, starting with Example 3-2. PublicClass.as, shows code outside the package - but if you follow this code - and compile, you will get: Error: 1114: The public attribute can only be used inside a package. (168) Example 4-44; The name of the class is given as "HeatedSeat.as", when it should be plural "HeatedSeats.as" as shown by the name of the class two lines down: public class HeatedSeats.... [227] Bottom of code - function onKeyPress(); The completed program will not work - the head of the rattlesnake is not connected to its body. After the BodySegments have been created and the Main class has been revised, the authors neglected to state that one must return to the onKeyPress() function (previously written out for the first draft of the Main class) and add the following: snake.update(); after the swtich conditional. I would think line 54 would be a good place for it. {253} Bottom on the page (3/4 down) in line 14 of the code example; Code currently reads: invoker.setCommand(conCommand) conCommand.execute() //execute command I believe the code should be: invoker.setCommand(conCommand) invoker.executeCommand() // execute command (322) Bottom of page - last three calculations; The equation is supposed to display the division sign, but instead shows the ascii equivalent ÷ {402} Heading--lower/middle of page; Currently reads "Minimalist Abstract State Pattern" Should read "Minimalist Abstract Strategy Pattern" (411) example11-7 clown.as; Unless I am missing a point in the composition idea, I think there is a typo in the last function (bolded) "setSkit" which should set the skit property. I'd imagine one would want to use the skit type for the typing of the passed parameter addskit /* instead of (addskit:Tricks)*/ as well as setting the skit property to the addskit parameter instead of setting the trick property /* tricks = addSkit; */. While I believe this code would compile, calling setSkit and passing an instance of Skit would could throw an error, or simply set the trick for that clown instead of the skit. /* the setSkit method is not called in example 11-20, pg.413 */ (435) Example 12-5 line 20; target.addEventListener(KeyboardEvent.KEY_DOWN, The last parameter and closing parentheses are missing. (439) In Figure 12-2; Figure 12-2 has two "view" classes in the diagram below the "RootNodeView" class. The second class is labeled "ACIICharLeafView". This should be "ASCIICharLeafView". (440) Example 12-9; In the constructor there are two parameters missing: aController:IKeyboardInputHandler, target:Stage) and on line 14 there's the second parameter missing for the target.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPress)