Errata

Programming Flex 2

Errata for Programming Flex 2

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 42
example code

Page number is from the rough cuts pdf. 2007/04/15 version.

Broken example. Code Fragment below...

<project name="FlexTest" default="run" basedir="./">
...
<target name="intialize">
<mkdir dir="${deployDirectory}" />
</target>
<target name="compile" depends="initialize">
...
</project>

Spelling mistake "intialize" should read "initialize".

Anonymous   
Printed Page 75
Last sentence/code fragment

The last parameter to button.removeEventListener() "onClick" should really be "clickHandler" to reflect
the code snippet above (since the text mentions that the parameters for both calls must be identical.

Anonymous   
Printed Page 75
Last line of section 4.7

The last part of section 4.7 reads as follows:
----
The following example removes the event listener added in the previous example:

button.removeEventListener(MouseEvent.CLICK, onClick);
----

However, in the "previous example" as far as I can tell, there was no event "onClick" registered:

---
button.addEventListener(MouseEvent.CLICK, clickHandler);
---

The proper name of the event that should be unregistered is "clickHandler" in this example -- if I'm
understanding what I'm reading.

Anonymous   
Printed Page 99
first paragraph after example 6-2

is: First, the initial layout contains six buttons

should be: First, the initial layout contains six labels

Anonymous   
Printed Page 141
Code samle under "Using PopUpButton"

I am using the Flex Builder 2.0.1 tool in Eclipse 3.2.2 and using the snipit of code included in the book
on page 141 under the "Using PopUpButton" section:

...
var xmlList:XMLList = <items>
<item label="ActionScript"/>
<item label="Class"/>
<item label="Interface"/>
</item>
<item label="MXML">
<item label="Application"/>
<item label="Component"/>
</item>
</items>;
...

Gives me the following error:

"Implicit coercion of a value of type XML to an unrelated type XMLList."

After digging around I found that I had to actually create a new XMLList object using the XML as the
parameter being passed in. Like so:

var xmlList:XMLList = new XMLList(<items>
<item label="ActionScript"/>
<item label="Class"/>
<item label="Interface"/>
</item>
<item label="MXML">
<item label="Application"/>
<item label="Component"/>
</item>
</items>);

I suspect this might be the case for any page that tries to create a var of type XMLList using the XML
directly instead of instantiating a new object. (Up until this point I have been creating my collections
using ActionScript). Maybe the first syntax is correct when compiling by hand, but Flex Builder doesn't
auto-compile unless I create the new XMLList object =(

Anonymous   
Printed Page 181
top paragraph

A sentence reads, "Therefore, changing a value in a numeric stepper used as an item renderer will not
affect the data provider, whereas it will update the data provider when used as an item renderer." It
seems as though the second "item renderer" should read "item editor" - but with this interpretation, the
"However" in the beginning of the next sentence doesn't seem to make sense.

[187/188] Example 8-17;
Does not work right, keyUpHandler generates errors 1023 and 1024.
Changing the name of the function made it work...

Anonymous   
Printed Page 202
4th paragraph

In the following code, a SWF library item is used as a button icon:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()">

<mx:Button label="Click me" source="@Embed(source='assets/library.swf', symbol='circleAnimation')"/>

</mx:Application>

The first instance of the word "source" should be changed to "icon".

Corrected Example Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()">

<mx:Button label="Click me" icon="@Embed(source='assets/library.swf', symbol='circleAnimation')"/>

</mx:Application>

Craig Lund  Jan 27, 2009 
Printed Page 223
public static function parseFromXML

"xml.@Itemname" should be "xml.@name"

"xml.@itemName does not match what is in the XML file

Also, in the XML file, the last checkbox uses "itemName" instead of name, and the value should be
something besides "city"

Anonymous   
Printed Page 250
Example 11-11, import statement line 3 and function initInstace parameters

Hi there,

i guess there's a little typo in the mentioned locations on page 250. The "mx.effects.EffectInstance"
class is imported and used as datatype for the parameter of initInstance. But, in my opinion, it has to
be the "mx.effects.IEffectInstance" interface in both places, because otherwise the override of
initInstance is not allowed.

Anonymous   
Printed Page 279
Bottom of page class

Syntax error in event string for both dispatched events.

should be :
dispatchEvent(new Event("aChange"));
dispatchEvent(new Event("bChange"));

fixed class bellow :

package com.oreilly.programmingflex.binding {

import flash.events.Event;
import flash.events.EventDispatcher;

public class CustomizedDataBindableExample extends EventDispatcher {

private var _a:String;
private var _b:String;

[Bindable(event="aChange")]
public function get a( ):String {
return _a;
}

public function set a(value:String):void {
_a = value;
dispatchEvent(new Event("aChange"));
}

[Bindable(event="bChange")]
public function get b( ):String {
return _b;
}

public function set b(value:String):void {
_b = value;
dispatchEvent(new Event("bChange"));
}

public function CustomizedDataBindableExample( ) {
_a = "a";
_b = "b";
}

}
}

Anonymous   
Printed Page 320
top paragraph

The text claims that "Type selectors always take precedence over class selectors." However, the reverse
is true, as shown in example 14-2.

Anonymous   
Printed Page 366
Missing class com.oreilly.programmingflex.lso.ui.LogInForm.as

I think a class com.oreilly.programmingflex.lso.ui.LogInForm.as referenced by the Main mxml class in the
login example is missing. I neithe rfind it in the book nor in the associated files. If possible, please
publish this class, because otherwise, the example code does not compile, thanks!

Anonymous   
Printed Page 450
1st paragraph

The example subclasses UIComponent. When I subclass UIComponent, nothing displays. If I subclass a
container like Canvas without changing any other code, the contents display.

Anonymous