Errata

Programming Flex 3

Errata for Programming Flex 3

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 1
Page 180, 1st paragraph, 1st line.

From the last line of page 179 to the first 2 lines of page 180.

It's said:

"In this case, the button has a green and italicized label because the local style definition takes precedence over the external stylesheet, only because it appears after the external stylesheet included in the code."

I think it should be:

"In this case, the button has a green and italicized label NOT because the local style definition takes precedence over the external stylesheet, only because it appears after the external stylesheet included in the code."

Haibo Liu  May 14, 2009 
6.1.1
6.1.1. Working with Children

In the paragraph right after example 6-2 Reordering children using the display list API. In the last sentence:

After the last child index is retrieved, setChildIndex() is called and passes a reference to the button instance and a new index.

The "button" Should be changed to "label". The correct sentence is shown below:

After the last child index is retrieved, setChildIndex() is called and passes a reference to the label instance and a new index.

Anonymous  Mar 09, 2009 
Printed Page 9
3rd paragraph

There's a minor typo:

The sentence

"The exact number and types of tiers an application has depend on many factors."

should probably read

"The exact number and types of tiers an application has depends on many factors."

Scott A Thisse  Oct 15, 2009 
Printed Page 15
2nd paragraph from the bottom

There's an extraneous ` in the word Flex.

Scott A Thisse  Oct 15, 2009 
19.5
after 3rd paragraph

example metadata tag for a 'horizontalGap' style uses incorrect inheritance attribute...

[Style(name="horizontalGap",type="int", inheriting="false")]

but according to the adobe online reference this should be re-written:

[Style(name="horizontalGap",type="int", inherit="no")]

http://livedocs.adobe.com/flex/3/html/help.html?content=metadata_3.html

Paul Evans  Feb 10, 2009 
19.5
after 9th? paragraph

<page-extract>
Here is the getter function that attempts to retrieve a valid value from getStyle(). If it does not find a valid value, it will return a default value of 5.

private function get horizontalGapDefault():int
{
var horizontalGap:Number = getStyle("horizontalGap");
return (horizontalGap == undefined ? 5 : horizontalGap);
}
</page-extract>

In the above page-extract, the code will not perform as intended. As my compiler warns :

"1012: Variables of type Number cannot be undefined. The value undefined will be type coerced to Number before comparison."

So, when the second line of the function executes, horizontalGap actually holds NaN, therefore the test for undefined fails and 5 will never be returned.

Additionally it would be slightly nicer if we were attempting to return the type indicated in the function (i.e. int rather than Number). Note: int can't be set to undefined either. It gets set to zero.

Paul Evans (creacog)  Feb 11, 2009 
Printed Page 23
Note at the bottom of the page

The compiler option "default-background-colorph" doesn't exist; the intended option is probably "default-background-color".

Scott A Thisse  Oct 18, 2009 
Printed Page 32
first paragraph

"Export Releaser Build option" should be "Export Release Build option"

DJPJ  Jul 09, 2010 
Printed Page 37
3rd paragraph

Page 37, third paragraph states, "A module document is used to define an MXML module, which you'll learn more about in Chapter 9."

However, no mention at all is made of MXML modules anywhere in Chapter 9, only MXML components, which are clearly stated in the book (and by Flex definition) to not be the same thing.

There appears to be no section at all in the book to explain the use and definition of MXML modules as opposed to components, which appears to be a large omission in the book of this breadth and comprehension.

Please include a section on Modules in the next edition.

Ivan Kanski  Jul 09, 2009 
PDF Page 38
Understanding namespaces

On this page author referenced about manifest file ("As shown in Chapter 2, a manifest file maps an ActionScript class to an identifier: the MXML tag name.") and .swc files ("This namespace URI is set when the .swc file is compiled, as described in Chapter 2.") in Chapter 2. But there is no nothing about it in Chapter 2.

Anonymous  Nov 17, 2008 
Printed Page 38
4th paragraph, 2nd paragraph of Understanding Namespaces

The paragraph begins, "As shown in Chapter 2, a manifest file maps an ActionScript class to...". That topic is not addressed in Chapter 2, but is addressed in Chapter 20.

Michael Maddox  Jun 17, 2009 
Printed Page 51
2nd line from bottom

The end quote for "Understanding ActionScript Syntax" is misprinted as an empty-box placeholder.

This same typos occurs on pages 50, 58, and others.

Scott Thisse  Oct 23, 2009 
Printed Page 51
general note

My comments about the CDATA tags apply to page 51, not page 52.

DJPJ  Jul 11, 2010 
Printed Page 52
general note section

Apparently, extracting the ActionScript code from an MXML file into an include file no longer requires the CDATA tag. From reading the note, it just says the .as code will be copied into the mxml file. I had to get rid of the CDATA tag to make it work. So I deduce that the mxml is converted to actionscript, then the include file is copied in, then the compiler kicks off.

I think this explanation would go well in that general note section to avoid the confusion I experienced.

DJPJ  Jul 11, 2010 
Printed Page 55
3rd paragraph that starts "Many developers..."

For the domain stated, examplecompany.com, the package name would be com.examplecompany, not com.example .

Scott Thisse  Oct 23, 2009 
Printed Page 56
1st paragraph

There is a minor typo on the 6th line -- the keyword "package" is split across lines w/o a hyphen.

Scott Thisse  Oct 23, 2009 
Printed Page 77
1st paragraph

The important concept of loading XML data is pretty much omitted here. After all aren't we supposed to separate the content? Showing the complete code and details to load the XML using ActionScript 3 would have been much appreciated here.
I finally did find code that compiled after much trial and error and learned all about how the swf had to be embedded in html and the xml must be in the same domain (I uploaded all three files to my website to avoid the security sandbox).
A very deep important thing to learn because dynamic xml loading at runtime is better than recompiling swfs all the time. Here is the ActionScript 3 code I found online.

package
{
import flash.display.Sprite;
import flash.errors.*;
import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLRequest;

public class ExternalDocs extends Sprite
{
public function ExternalDocs()
{
var request:URLRequest = new URLRequest("http://www.cbl-productions.com/books.xml");
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeHandler);
try
{
loader.load(request);
}
catch (error:ArgumentError)
{
trace("An ArgumentError has occurred.");
}
catch (error:SecurityError)
{
trace("A SecurityError has occurred.");
}"
}
private function completeHandler(event:Event):void
{
var dataXML:XML = XML(event.target.data);
trace(dataXML.toXMLString());
}
}
}

Craig Lund  Aug 30, 2009 
Printed Page 85
First note

In first note on page 85, next to last line, there's a box instead of a right quotation mark at the end of the reference "Understanding Application Domains"

Anonymous  May 07, 2009 
Printed Page 119
2nd line of page

The sentence says, "In this example, we declared two ColumnConstraint instances...". What the code fragment declares is actually two ConstraintColumn instances.

Anonymous  Jul 06, 2009 
Printed Page 119
5th item in bulleted list

"Setting the right style property at runtime .... " should be "Setting the right style property sets the x value of the child at runtime .... "

DJPJ  Jul 13, 2010 
Printed Page 140
code samples

The code samples that use the '-=' operator are flagged by flex builder as a syntax error when I copy and paste the code from the downloaded examples.

If I delete the '-=' and then retype it, the error goes away. Looks like those characters are losing something (or encoded wrong) in the download files. I'm on a Windows Vista machine with Flex Builder 3.

DJPJ  Jul 21, 2010 
Printed Page 149
code after 5th paragraph

example code:
var xml:XML = <items><item>a</item><item>b</item><item>c</item><item>d</item></items>;
var collection:ICollectionView = new XMLListCollection(xml.children());

to actually compile without errors should be:

import mx.collections.ICollectionView;
import mx.collections.ArrayCollection;
import mx.collections.XMLListCollection;

private function makeCollection():void
{
var xml:XML = <items><item>a</item><item>b</item><item>c</item><item>d</item></items>;
var collection:XMLListCollection = new XMLListCollection(xml.children());
list.dataProvider = collection;
}

Craig Lund  Aug 31, 2009 
Printed Page 149
last code example (149-150)

code is broken. Like much of the code examples in this book, there are methods, functions etc. missing. I have struggled with many examples in this book and the previous Flex 2 book and figured out what was missing.
While this can be educational, it is also frustrating to compile the code and receive so many time consuming errors that distract from the focus of the lessons.
Other sources of code usually show the complete code with the code that is being examined set in bold. At least this way, novices can actually work with it.

Craig Lund  Aug 31, 2009 
Printed Page 178
last paragraph

This is real minor, however the second to last sentence on this page has a typo: "(.green)" should be "(.example)".

"... and instead both selectors are defined simply as class selectors with the same name (.green) and the second overwriting the first."

Matt Loflin  Feb 10, 2011 
Printed Page 179
3rd paragraph

The first sentence of the 3rd paragraph states "Type selectors always take precedence over class selectors." It should read "Class selectors always take precedence of type selectors."

Brian Sterling  Dec 11, 2008 
Printed Page 179
3rd paragraph

First sentence reads: "Type selectors always take precedence over class selectors.". This is incorrect; it's the other way around, just as the book points out on pages 174 and 182.

Joe Berry  Nov 12, 2009 
Printed Page 194
code example

Here's another example that embeds a file that is not included with the code example files. The examples in this book are pretty weak. Code snippets instead of working examples are numerous, and now I have to scour the internet to see if I can come up with embed files to make the examples work. I found some century gothic font files to make some of the examples work, then I found some button up, down, and over icon files to make other examples work. But what the heck is vbox_background.png? I've also had to spend hours fixing bugs in the examples. I'm growing more and more dissatisfied with this book. And there's no confirmed errata? What a joke.

DJPJ  Jul 25, 2010 
Printed Page 293
coding example

Error:

The class SoundPlayer's function play() will not play the file upon opening. The "Play" button in the MXML application does not function unless the "Stop" button is played first.

Debugging:

If Play() works after Stop() this is because Stop() attributes a value to _currentPosition, namely 0. Play() needs a value for _currentPosition to start playing.

Solution:

Set _currentPosition to 0 in the SoundPlayer constructor
so that play() can function as intended.

Code correction:

Code to be added in the body of
public function SoundPlayer(url:String):

_currentPosition = 0;

Anonymous  Aug 16, 2009 
Printed Page 312-313
Example 12-11 and 12-12

The <item> nodes in the sample XML in Example 12-11 all have an "item" attribute, except for the last <item> node, which has an "itemName" attribute instead.

When this sample XML is referenced in Example 12-12 in the parseFromXML() method, it assigns the "name" variable the value of "xml.@itemName". Clearly, this will only work for the last <item> node.

Either all the "item" attributes need to be changed to "itemName" in the XML or the "xml.@itemName" needs to be changed to "xml.@name" in the parseFromXML() method and the final <item> node in the XML needs to be changed to match.

The latter would seem to make more sense given the convention of assigning "type" to @type, "label" to @label, etc., but that's just my 2 cents.

Cade Truitt  Oct 09, 2009 
Printed Page 370
example 14-1 user Class and create Instance MXML example

I got all the code input and compiled error free but the result is what?
All I see is a blank application. The exercise should have an end result shouldn't it?
Use in any practical way still seems awfully vague to me.

Craig Lund  Sep 16, 2009 
Printed Page 370
example 14-1 user Class and create Instance ActionScript example

The incomplete example does not address handling the {new Date()} portion. Just adding the wo or three lines of code rather than "etc." would have been much more preferable.
I have tried various syntaxes but get a type error or a syntax error when trying to compile.

Craig Lund  Sep 17, 2009 
Printed Page 455
bottom

The text refers to an HTTPService object.
The example code to create an object is (bottom of page 455):

var httpRequest:HTTPRequest = new HTTPRequest();

Example 17.6 uses,

_service = new HTTPService();

Neither Adobe's documentation http://livedocs.adobe.com/flex/3/langref/
nor the Flex Builder environment reveal the existence of any HTTPRequest class.

Therefore it appears to me that the example code at the bottom of page
455 should be

var httpService:HTTPService = new HTTPService();

This threw me for quite some time because I recall creating HTTPRequest objects in javascript a while back.

Also, there is an HTTPRequestMessage class. The book does not explain this (that I've found so far at least).

If this is not an error then I would appreciate clarification of the relationship between HTTPService, HTTPRequest, and HTTPRequestMessage classes as well explanation of how to create an HTTPRequest object when this class doesn't seem to exist.

thank you,
-Eric Saund
new Actionscript developer

Eric Saund  Feb 20, 2009 
Printed Page 562
Top of the page

Has a reference to the non-existent "resolveFile" method, it should refer to "resolvePath" instead.

i.e. File.applicationStorageDirectory.resolvePath("example.db"); instead of File.applicationStorageDirectory.resolveFile("example.db");

Kirill Mazin  Dec 29, 2008