acromedia just announced the sixth version of the Flash IDE and player, Flash MX, which positions Flash as the vanguard of an entirely new project strategy, called Macromedia MX. Flash MX offers what Macromedia calls a rich client, a highly experiential, integrated thin-client environment for content, communications?and applications. Until now, Flash has provided only the ability to integrate multimedia elements into existing Web pages, but the new version radically extends Flash’s capabilities, making it possible to create an entire dynamic site in Flash, from content display, to database connectivity, to video to debugging. The result is unprecedented; Flash’s integrated multimedia authoring power comes close to making standard websites obsolete.
Flash MX is the first product release in the new MX product line.
Those of us who used Flash 1.0 or its predecessor, FutureSplash Animator, know that its flexible keyframe animation, tweening, and vector art support breathed new life into Internet image delivery, and provided a robust alternative to simple GIF animations. Since then, Flash has evolved from a rudimentary animation tool to a complete multimedia authoring environment.
New Interface, New Workflow
While current Flash developers will feel right at home in the IDE, the interface has undergone modifications that reflect the maturity of the platform. Most notably, Flash MX offers two authoring modes, one for designers and one for developers, a change that reflects the increasingly compartmentalized roles of professional Flash developers?some who work heavily in ActionScript code and others who design primarily from a graphical perspective.
The workspaces are really just view sets of individual panels such as Actions and Properties, but the new views and new features allow better isolation of Flash workflow in general. Developers in particular will appreciate improvements in the Actions panel, especially the new contextual code hints and ActionScript references within the IDE (see Figure 1 and Figure 2).
Flash MX also introduces Shared Library Assets. Users can share objects both in design-time and runtime, making common component management easier, and streamlining the movies themselves. To help further facilitate development in highly managed production environments, Flash MX integrates directly with SiteSpring, Macromedia’s workflow management server. SiteSpring users can check content in and out, update status, and communicate with their teams without leaving the IDE.Server Integration
One feature missing from this version of Flash MX is true server application integration, but that’s coming. ColdFusion MX, which is expected this summer, is the first market evidence of the merger between Macromedia and Allaire. Consisting of a Flash Application Server Gateway and a Communications server, Flash authors will be able to integrate applications on J2EE and .NET servers, as well as the ColdFusion MX server via a protocol built into the Flash 6 player itself.
The application server gateway provides an interface between app servers and the Flash client that goes beyond the useful but inflexible HTTP Get/Post methodology Flash currently provides. Right now, Flash authors must build an intermediary interface to server applications that can accept requests via HTTP. Typically this entails an ASP, PHP, or JSP page that brokers requests to and from a server application. The application server promises to eliminate this middleman.
The communication server promises to broker direct inter-client connectivity for applications such as synchronous messaging. In addition, Macromedia will also release Dreamweaver MX, which will add support for additional server and connectivity technologies for Flash and application architects. If you’ve been creating middle-tier pages to connect Flash clients to servers dynamically, you will be glad to know that you won’t have to do that much longer. Until then, Flash MX offers an abundance of new features.
Flash MX includes numerous upgrades that let you do more work within Flash itself, so you’ll do less prepping and importing of content from applications into Flash.
A new Color Mixer panel makes the process of arbitrary color selection intuitive. In addition to selecting colors directly, you can specify RGB or hex color values manually in the Color Mixer. The Mixer lets you create gradients in the same simple fashion as Freehand or Adobe Illustrator. Transformation and distortion tools make their appearance for the first time, minimizing the need to use special illustration software. Designers can specify element positions on the stage down to the pixel level, which provides much greater visual control.
Flash MX improves the Library and Timeline. Text controls can now render HTML directly, including URL links to external resources or even resources inside the movie itself, such as the results of ActionScript function calls, and the Timeline now supports layers.
Video & Sound
In previous versions, you had to exit the Flash environment to display video clips, such as movie trailers. But Flash MX lets you import a host of major video formats directly into the Flash movie itself. Unlike Flash 5, which stored video as a series of JPEG images, video in Flash MX preserves the media type. Flash MX includes a special Sorenson codec, Sorenson Spark, which operates both in the IDE (encoding) and in the player (decoding), that streams high quality video. At present, Flash MX supports AVI, Digital Video, MPEG, QuickTime, and Windows Media video formats. Flash MX can also maintain external links to QuickTime-formatted video, which allows designers to separate the video files from the Flash source (see Figure 3).
For now, Flash won’t support streaming audio formats, but a Realtime Messaging Protocol (RTMP) based streaming audio and streaming video server will accompany the other MX products by mid-year. Flash MX offers more advanced sound control than version 5, including the ability to synchronize movie elements with sound clips.
Internationalization & Accessibility
In a major leap forward, Flash MX has solved two major access problems of Flash 5, support for non-Western encoding and improved user accessibility.
In Flash 5, creating a movie in a non-Western encoded language seemed almost harder than learning to speak the language. To create Japanese content, for example, authors needed to use a third party tool for double-byte integration, or a Japanese OS and the Japanese version of the Flash authoring environment (and therefore a native-speaking Japanese author). But with Flash MX, all you need to do is install and set the proper language encoding (Control Panel > Regional Options on Windows 2000/XP, System Preferences > International on Mac OS X), and type text directly into any Flash element. All text in Flash MX uses double-byte character encoding (DBCS), and exports to UTF-8 in SWFs for use in the player. Of course, this means that all the content of a movie must be in only one encoding?you can’t change encodings on the fly?but that limitation should cause few problems. Flash MX text boxes now support both right-to-left and vertical text directions to assist with internationalization (see Figure 4).
Developers and designers should take care when using Unicode text loaded dynamically (e.g. via XML, loadVariables). In my tests, text loaded fine from loadVariables and XML sources when that data was UTF-8 and UTF-16 encoded. Unicode text transmitted over the Internet must be UTF-8, but the player had trouble with other encodings. Also keep in mind that text rendered with device fonts will require end users to have the fonts installed on their machines.
The Flash 6 player (which is available in beta now, but will be released officially on March 15) now supports screen reader technology for text and input fields that comply with Section 508 accessibility standards. Because the player uses Microsoft Active Accessibility (MSAA), Section 508 compliance is available only in the Windows version of the Flash player. The release documentation provides tips for building accessible Flash content.Development Features
Flash MX offers widespread performance increases, greater control of movie elements from ActionScript, and a step-through debugger.
Objects and Events
Any developer who made the transition from Flash 4 to 5 knows what a major evolution ActionScript underwent in the product’s last version, evolving from a simple toolkit built for artists to a relatively robust medium for a wide variety of development. With Flash MX, ActionScript is a step closer to ECMA-262 (ECMAScript) compliance, including Unicode support, a new switch statement, strict equality (===) and inequality (!==) operators, and?best of all?true object classes and event handlers.
Using ActionScript’s new object syntax, developers can create custom classes rather than having to rely on loopholes in ActionScript syntax. Previously, authors could only simulate class abstraction by loading custom object constructors from external .as files or instanced MovieClips. Now, developers can register classes globally and instantiate them anywhere. ActionScript provides object prototyping through a standard object.prototype syntax. You can inherit from and override methods in existing classes, and the new form of the keyword super lets you invoke superclass methods or constructors.
Because objects can be either pure code or a combination of code and media elements in the context of a MovieClip, Flash MX offers a unique way to associate either a MovieClip symbol or a standard object class with an ActionScript class. The Object.registerClass() method that provides this service takes two arguments: the linkage identifier for a MovieClip or the name of the ActionScript class, and the class constructor. On the downside, registering MovieClips can be a bit confusing, but here’s the process: To register a clip in the Library panel, choose linkage for the chosen symbol, check the Export for ActionScript option, and provide a linkage name. All new instances of registered MovieClips automatically register to the specified class. (See Listing 1 and Sample 1. You need the Flash 6 player to view the samples. You can download the beta player here.
ActionScript provides flexible event handlers that respond to object events, such as mouse clicks and key presses. Instead of awkwardly attaching individual actions to objects themselves via instance ActionScripts (e.g. onclick), Flash MX exposes event handlers for prototype objects, such as MovieClip and XML. ActionScript can define or override handlers for these events.
Among the ECMA compliance features still missing from ActionScript are try, catch, throw, error trapping, runtime-compiled eval statements, and strict XML validation using DTDs. These limitations will be less critical with the forthcoming MX application integration because rigorous application engineering can be handled seamlessly on the server. In the meantime, ActionScript classes make it possible to overload problematic object functions or event handlers for greater control. For example, the XML object’s onData event handler fires before the existing onLoad handler, letting you override the internal XML parser.
Flash MX extends Flash 5 SmartClips into new objects called Components. SmartClips offered a way to consolidate complex functionality into common library elements, such as scrollbars and charts. While the raw power of Flash Components lies in the terrain of the developer, designers will also reap many of their time-saving benefits. MX provides a set of basic UI components for forms, including checkbox, combo box, push button, etc. One of the most useful UI components is the Scroll Pane, which automates a process almost every Flash author has had to create manually at one time or another.
The Component Parameters panel is another important improvement over SmartClips that greatly simplifies work for designers and developers alike. Unlike SmartClips, Flash MX components are more like traditional software components. You set properties at either design-time or run-time to manipulate a component. For example, an address form component might expose a Region parameter. Changing the parameter from US to UK could change both the visual form elements themselves, and underlying validation or other behaviors. Component parameters give designers a neat and direct interface to the component (see Figure 5).
Knowing that most applications use form elements in one way or another, Flash MX also lets designers change UI Component skins relatively easily. For global changes in a movie, find the Component Skins folder in the movie’s Library and edit the chosen elements. Developers should note that new ActionScript interfaces make it possible to register component skins at runtime.
The real power of Components is that you can create your own, place them in a code library, and then share them at both design- and run-time. Unfortunately, Macromedia doesn’t provide any good tutorials or examples, so learning the process the first time can be mind-bending. A component is similar to a linked object, but with additional definitions for design-time control and panel docking.
To create a component, define and link a MovieClip symbol and include any additional graphical materials. In an action, wrap a class definition in an #initclip .. #endinitclip directive (this ensures that the class initializes only once). Then define the MovieClip as a component in the Library. To define parameters for the component, simply add them in the Component definition dialog in the Library. The property editor allows you to define a parameter name and a bound variable; take care not to confuse the two. The parameter name is what will appear in the Properties panel; the variable is the object variable name that will be set if the parameter is defined. For example, a parameter called value might be bound to a class variable called initValue. When you create a class instance with the parameter defined, the code this.initValue will return the parameter value. See Listing 2 and Sample 2 for a simple example of a custom component.
Connecting with Flash
Flash MX offers a number of major improvements in data connectivity. The most noticeable is a twenty-fold performance boost for the on-board XML parser. Even simple XML parsing was slow in Flash 5, but data snaps into place in the Flash 6 player. Best of all, authors who have already published XML-connected movies in version 5 will benefit from the performance increase when loading those movies in the new player.
Flash MX also offers two new client-side connectivity features, Local Connection and Bookmarks. Local Connection lets separate Flash movies on the same machine to send messages, data, or execute scripts between one another. One use of this feature is to converse between Flash movies on the same HTML page, for example a navigation movie and a contextual help movie. The navigation movie could update the contextual help movie when users switch between sections. The conversing movies don’t even have to be in the same window.
One major change for the MX product line is the retirement of Generator, Macromedia’s server software for dynamically rendering images and other content into Flash movies. Those capabilities will appear in the the MX server releases soon. In the meantime, XML and socket communication for real-time dynamic data and text carries over from Flash 5, and Flash MX adds the ability to dynamically include both image (JPEG) and sound (MP3) content in movies at runtime. Dynamic resources are remarkably easy to use: just use the loadMovie() and loadSound() methods, respectively. Many developers got around Flash 5’s inability to load images dynamically by manually creating .swf wrappers for JPEGs or MP3s. Now you can achieve the same result with the same loadMovie() syntax, and a lot less work (See Listing 3 and Sample 3). This feature is especially useful for streaming music (the second parameter of Sound.loadSound() specifies whether the sound streams or not). Previously, sounds had to be attached from the Symbol library or dragged directly into the timeline.
This technically minor addition alone will greatly evolve the Flash platform, even before the full MX product line’s release. In an HTML web page, you take for granted the ability to use the HTTP protocol to load disparate elements into a coherent whole, but Flash has lacked this basic hypertext feature until now (See Figure 6).
Anyone who has built an entire website in one large Flash movie knows that you lose the ability to navigate through pages or sections with the browser history, an easy feat on HTML websites. But now, Flash MX authors can add Named Anchors to any frame on the timeline, or set the IDE to automatically create a named anchor at the beginning of every scene. Users can then navigate through Flash movies using their browser’s Back and Forward buttons. Sample 4 gives a visual example of how named anchors work.
Flash MX offers an ActionScript API so you can draw vector graphics directly to the stage using new MovieClip object methods. Developers can programmatically render vector shapes through line, curve, fill, and gradient methods. Authors can exploit these features for real-time data visualizations, like charts and graphs. Additional features in this and future versions include tweened masking, external media device support, improved PocketPC support, an event-savvy object-based interface to loadVariables(), and listeners that let you fired multiple responses to single events (such as a mouse click).
I do have a few grievances that shouldn’t go unmentioned.
- The documentation and on-line support that comes with the product itself is quite meager. Examples are few and unenlightening, and detailed, step-by-step explanations for key features are unwritten or hidden. For example, custom components, a major new feature in MX, receives no treatment in the documentation. Happily, Macromedia promises to publish additional documentation on the Macromedia designer and developer center
- While it’s not huge, the Flash 6 player is hefty enough to give pause to low-bandwith developers, up in the 350K range for the Windows IE version.
- Better published movie protection would be nice, as well as the ability to override the security sandbox for XML objects, to allow XML transfers from remote domains. Without override ability, developers will have to build intermediary server applications for Web service-based applications.
- Support for streaming media metadata files such as wvx would also be helpful; until summer, authors will still have to spawn HTML windows to display large-volume streaming video