|MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA|
Colin Moock on Flash MXby Richard Koman
Macromedia's introduction of its suite of MX applications this summer (Flash MX, ColdFusion MX, Dreamweaver MX, and Fireworks MX) is a shot across the bow of enterprise software developers who might have written off the company's offerings as lightweight tools for HTML coders and designers who want to play around with ColdFusion.
For years, ColdFusion developers and ActionScript aficionados have been telling us that you can do more with this combination than people attuned to the Java or Microsoft development platform thought. Now Macromedia intends to make the point more firmly with its MX package of applications that Macromedia's tools are suited for enterprise-level development of transactions, web services, and a more sophisticated form of user interface that it calls Rich Internet Applications.
Tools aside, Macromedia believes one of its competitive edges entering this market is the nearly ubiquitous distribution of the Flash Player on web clients -- not just browsers across most platforms, but on handhelds and even some mobile phone platforms. It believes there's a strong selling proposition to be made in comparison to Java or .NET when a Flash-based application can run as well on a Windows, Mac, Linux, or Palm platform. To put a stake in the ground while demonstrating the system to developers, it has published a blueprint application called Pet Market, designed to enter the fray between Sun's Java Pet Store blueprint application and the .NET Pet Shop. (For a detailed comparison of these two, see Dean Wampler's "Cat Fight in a Pet Store: J2EE vs. .NET" on ONJava.com, Nov. 28, 2001.)To learn more about the MX platform, we talked with Colin Moock, author of O'Reilly's ActionScript: The Definitive Guide.
To get a handle on Macromedia's new paradigm, think "Flash clients" rather than "Flash movies." Developers are now starting to think about writing not just the user interface but full-blown clients with Flash and ActionScript -- Flash's ECMAScript-compliant scripting language.
To say that Flash is a client development platform is to question the idea that web clients must be browsers. But of course web clients aren't always browsers; the Web services concept says that web clients can be programs -- as long as they speak XML. The conventional wisdom is that you convert XML to HTML for presentation to users. But why not format XML for display in Flash rather than in HTML? With Flash's ability to display a variety of media in a rich, integrated environment, with its ability to hold open HTTP connections to servers for real-time updating of data, and its ability to write typed data to a user's disk, Flash looks at least as good as a client environment as HTML.
A great example of this is the reservation site for The Broadmoor hotel, where you can select dates of your stay, select your room type, number of rooms, adults, and children, and enter credit card information all within the Flash application. Changes to your reservation are updated immediately in the reservation summary.
With the addition of video, Flash naturally becomes even more interesting to the entertainment industry. "A movie site is just a natural for a Flash environment," says Moock. "It's just a holistic thing -- you don't have to go off to the downloads page and leave the running video."
And of course ActionScript enables a movie site to offer much more than a simple trailer download. A site could interrupt playback of the trailer with a user survey or an interactive game.
"You could mask video if you want to. It could be a background element," Moock says. "It could play until it reaches its one-hundreth frame and stop and ask you for some input. You could also overlay interactivity. It's not quite as graceful as say a SMIL file that would tell you specific timecodes, but you could do that all in Flash, having clickable portions of a video just by overlaying buttons, that sort of thing."
Flash offers a single environment for a world in which so many different types of media are used. "It sure is nice to be able to incorporate all these different types of media into one file format," Moock says. "It's not an HTML page that's broken into text, server calls, images, pop-ups that have RealPlayer in them ... it's nice to be able to work in one world and create these self-contained applications. If there's a video piece in your product description, then great, just add it in."
For real-time applications, Flash can open a two-way, raw data connection over TCP/IP with a server. This allows for data to be updated in real-time in the Flash client, without the awkwardness of having a browser reload every x seconds. The applications for this are obvious, such as a live stock ticker or sports updates. Imagine a Flash movie that checks your auctions on eBay and alerts you when you've been outbid or when the auction is nearing completion. "You could have done these things in Flash 5," Colin said. "The impediment there was, you had to write the server yourself. In Flash 6 [dubbed Flash MX], Macromedia is moving to a product that will do lots of real-time stuff including audio and video, which could be quite cool." In the meantime, Moock has written a server called Unity to free developers from the trouble of writing their own.
Another addition to Flash MX is the "shared object," which lets Flash authors write a file to the user's file system. Unlike a browser cookie, which is merely a string, shared objects retain their type, so a stored array is still an array when you read it back. Moock says this enables Flash developers to create desktop-style applications -- up to a point."
"You could build an MP3 player in Flash," Moock says. "It's sort of crossing into what Director can do, but it's still limited by how much access you have to the local file system. Even so, you can do quite a few interesting connected applications that have such a small footprint and such an easy dev environment. You can get way, way richer than VB would ever let you get because the authoring environment is based on animation and multimedia." Moock cites the example of a home planning tool that lets you layout rooms and walls. "That's the sort of thing that would be so painful to do in VB but it's easy to do in Flash.