13
CHAPTER 1
What’s New in Flash MX 2004 ActionScript
Macromedia Flash MX 2004 and Macromedia Flash MX Professional 2004 provide several
enhancements that make it easier for you to write more robust scripts using the ActionScript
language. These new features, which are discussed in this chapter, include new language elements,
improved editing and debugging tools (see “ActionScript editor changes” on page 21 and
“Debugging changes” on page 22), and the introduction of a more object-oriented programming
model (see “New object-oriented programming model” on page 22).
This chapter also contains an extensive section that you should read carefully if you plan to
publish any of your existing Flash MX or earlier files to Flash Player 7 (see “Porting existing
scripts to Flash Player 7” on page 15).
New and changed language elements
This section describes the ActionScript language elements that are new or changed in Flash MX
2004. To use any of these elements in your scripts, you must target Flash Player 7 (the default)
when you publish your documents.
• The Array.sort() and Array.sortOn() methods let you add parameters to specify
additional sorting options, such as ascending and descending sorting, whether to consider case
sensitivity when sorting, and so on.
• The Button.menu, MovieClip.menu, and TextField.menu properties work with the new
ContextMenu and ContextMenuItem classes to let you associate context menu items with
Button, MovieClip, or TextField objects.
• The ContextMenu class and ContextMenuItem class let you customize the context menu that
is displayed when a user right-clicks (Microsoft Windows) or Control-clicks (Macintosh) in
Flash Player.
• The Error class and the throw and try..catch..finally commands let you implement
more robust exception handling.
• The LoadVars.addRequestHeader() and XML.addRequestHeader() methods add or change
HTTP request headers (such as
Content-Type or SOAPAction) sent with POST actions.
• The MMExecute() function lets you issue Flash JavaScript API commands from ActionScript.
• (Windows only) The Mouse.onMouseWheel event listener is generated when the user scrolls
using the mouse wheel.