
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Components Complete
|
315
Components Complete
We’ve come to the end of our look at a component-based ActionScript 2.0 applica-
tion. If you want to see the currency converter in action, you can download all the files
discussed in this chapter from http://moock.org/eas2/examples. For a lot more informa-
tion on both using and authoring components, see Flash’s online Help (Help
➝ Using
Components) and the components section of Macromedia’s Flash Developer Center at
http://www.macromedia.com/devnet/mx/flash/components.html.
In the next chapter, we’ll continue our exploration of controlling and creating visual
assets by studying MovieClip subclasses.
Table 12-1. Component-event-handling techniques
Technique Example Notes
Generic listener
object
var convertClickHandler:Object = new Object( );
convertClickHandler.click = function (e:Object):Void {
thisConverter.convert( );
}
convertButton.addEventListener("click",
convertClickHandler);
Generally, the
preferred
means of han-
dling compo-
nent events
Typed listener
object
convertButton.addEventListener("click", new
ConvertButtonHandler(this));
Sameas generic
listener object,
but exposes
event-handling
code more
explicitly
EventProxy class
convertButton.addEventListener("click", new
EventProxy(this, "convert"));
or
convertButton.addEventListener("click", new
EventProxy(this, ...