• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 1. What's New in AS2 > Language Changes

Language Changes

Here's a brief summary of changes. I'll let you RTFM (read the, uh, fantastic manual) for the specific syntaxes and such.

  • Array.sort() and Array.sortOn() allow extra sort parameters so you can set ascending or descending sorting order and consider case sensitivity.

  • The ContextMenu and ContentMenuItem classes let you customize the menu that pops up when someone right-clicks (PC) or control-clicks (Mac). You can reach these properties via Button.menu, MovieClip.menu, and Textfield.menu.

  • Error handling takes place through the Error class, throw, and try...catch—finally.

  • You can use LoadVars.addRequestHeader and XML.addRequestHeader to tweak HTTP request headers.

  • MMExecute() lets you execute Flash JavaScript API commands.

  • AS2 offers better depth handling via MovieClip.getNextHighestDepth() and MovieClip.getInstanceAtDepth(). I'm happy to see these changes—my depths and levels often get a little out of control.

  • Movieclikp.getSWFVersion() gets the Flash Player version of a loaded SWF file.

  • MovieClip.getTextSnapshot() lets you work with static text in a movie clip. The only way to create static text is during authoring. All runtime text fields are either dynamic or input. Note that runtime means “created by ActionScript while the Flash movie is playing.”

  • MovieClip._lockroot lets you specify a movie clip that will act as _root for any movie clips loaded into it, or lets you specify that the meaning of _root in a movie clip won't change if it's loaded into a different movie clip.

  • The MovieClipLoader class lets you monitor the progress of files as they're being loaded. Its purpose is to just watch the loading and report on it.

  • The NetStream and NetConnection classes let you stream local video files (FLV files only).

  • The PrintJob class gives you more control over printing.

  • Sound.onID3 gives you access to ID3 information in a sound file, if it exists. If it does, you can get to that property via the Sound.id3 property (more in Topic 25, MP3s and ActionScript).

  • More objects and methods are provided in the System class, and more methods are provided in System.capabilities.

  • TextField.condenseWhite lets you remove extra white space from HTML text.

  • TextField.mouseWheelEnabled lets you specify whether a text field scrolls when the user rolls the mouse wheel. You also get the Mouse.onMouseWheel event listener.

  • The TextField.StyleSheet class lets you create a CSS-like style sheet object that can be used over and over. It also includes the Textfield.styleSheet property.

  • TextFormat.getTextExtent() returns all sorts of super-precise information about a text field.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint