Web DevCenter
oreilly.comSafari Books Online.Conferences.
MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA

Sponsored Developer Resources

Web Columns
Adobe GoLive
Essential JavaScript
Megnut

Web Topics
All Articles
Browsers
ColdFusion
CSS
Database
Flash
Graphics
HTML/XHTML/DHTML
Scripting Languages
Tools
Weblogs

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed

Learning Lab






SWF Is Not Flash (and Other Vectored Thoughts)
Pages: 1, 2

SWF Does Have a Structure, But It's Not XML

SWF is often accused of not having a structure. Well, that's not true. It doesn't have an XML structure like SVG does, but it is quite easy to convert SWF vector graphics into a structured XML document, if necessary. It's true that the design of the SWF brings memories of the old IFF multimedia format (still doing well in some applications), but it works quite well.



Sure, being an XML application, SVG is immediately familiar to an enterprise user who's implementing XML throughout his or her organization. Therefore, SVG can be easily integrated into the whole system. There are many tools for generating and parsing XML, and they can be applied to SVG. But what's it good for in case of vector graphics? Aren't we trying to shoot mosquitoes with ICBMs (Intercontinental Ballistic Missiles)?

XML is a godsend for documents that already have some sort of a primitive structure, like medical records, financial reports, encyclopedias, dictionaries, customer databases, and so on. Such documents, when structured according to the syntax rules of one DTD can then be easily transformed into other formats and syntaxes. And this particular feature is very important for the enterprise clients, because adding structure to data makes it easier to manage and reuse in the future.

It makes sense to use XML to store financial data, because it is then much easier to convert it into a visual representation, and SVG, being an XML application, fits the equation quite nicely. But so could any other format that we can write XSLT or DSSSL transformation rules for, because once numeric data is transformed into some business chart, that's the end of the road for it.

We can't process that data any further, unless we want to convert it into another graphics file format. There's no way to turn images back into the source numeric data. And if it's not possible, then SWF and SVG are just as good as any other vector graphics file format. All that one can do with an SWF or SVG image is convert it into another file format, or extract some parts of it, just like it can be done with TIFF, GIF, JPEG, IFF, and other "multimedia" file formats. XML gives SVG an edge, but it is not essential.

Dynamically Generated SWF

It's possible to create customized SWF files and you don't necessarily need to use a commercial application like ColdFusion MX or the late Generator. There's enough free code on the Internet to help developers create their own SWF generators similar to Adobe AlterCast. This is, after all, yet another variation on the Web page templates theme, albeit more complex. The formats have changed, but the principles remain the same.

You can easily turn data described using XML syntax, or any other semantics for that matter, into SWF files on the server-side. Simply use libswf, Ming, FreeMovie, or even the freely available SWF C++ SDK from Macromedia. Granted, it does take time to learn how to work with SWF, but the same can be said about learning SVG.

Flash Player: A Uniform Platform Is Not a Bad Thing to Have

Macromedia controls the Flash Player, and it's been a problem for those users who, quite rightly, claim that it stops an even wider acceptance of the Flash technology, especially on mobile devices and free operating systems. I think Macromedia is in a difficult situation here and has to tread very carefully. On one hand, publishing the source code for the Player would earn the company a lot of good karma and free up a lot of its resources as the open source community could take over the tasks of porting and improving the Flash Player plug-in.

But on the other hand, that would make it possible for competitors to embrace and extend the functionality of the Flash Player and unnecessarily divide the market. If worst came to worst, we'd be required to download dozens of different Flash plug-ins. I doubt anyone wants that to happen.

So far, the Macromedia's decision to control the development of the Flash Player in-house helped it achieve full compatibility across all officially supported platforms. This is not a bad thing to have if you are a Web designer who has a client demanding cross-platform compatibility.

Related Reading

SVG Essentials
By J. David Eisenberg

Macromedia could provide help for groups of developers interested in porting Flash Player to platforms other than those officially supported by Macromedia. Last time I checked Macromedia did offer access to the source code of Flash Player, but reserves the right to choose who can see it. Sounds fair to me. Those who don't pass the threshold can still develop their own version of Flash Player using the officially available SWF specification, just like anyone can develop their own HTML browser.

Flash and Mobile Devices

Regardless of our choice of poison, SWF or SVG, we have to wait for mobile devices to have more power to support either SWF or SVG (even in its Mobile incarnation). Meanwhile the ugly cHTML and i-Mode will rule.

The problems with using either Flash or SVG on mobile devices are not due to particular weaknesses of these technologies, but because nobody's figured out yet how to automatically downgrade applications, discarding fluff and keeping the essential components and functionality. There's still a lot of research to be done in that area.

Flash Uses Bandwidth Efficiently

SWF can carry more data encoded using the same number of bytes than SVG. Compared to SWF, SVG is a bandwidth hog. It doesn't matter that much on the workstations connected to fat pipes, but it does matter for dial-up users or people located on the other side of the globe. It is also very important for mobile Web applications.

Why Is Flash So Popular?

Flash has become popular among Web designers because it is a complete solution: a well-designed authoring application, a robust file format, and a widely distributed player.

Macromedia wasn't the first to try to popularize vector graphics (one of the first attempts must have been their own Director, Broderbund's Fantavision, or Motion Works' ADDMotion), and they won't be the last, but the Web design community has chosen Flash and that's a fact. Even the best technology in the world won't become popular if people don't like it.

And there's a lot to like about Flash: one platform to develop for, no need to worry about the Web-safe color palette, all components can be bundled into a single file, good authoring tools, support for forms, an XML parser, and a powerful programming language.

With Flash, anyone can create interactive applications, catalogs, and animations and distribute them online. There is no need to learn DHTML or any other underlying technology. Flash simply lets creative people focus on the creative part of the job, without worrying about the technology that makes it all possible.

A consistent look; a high degree of control over document layout; and ease of mixing sound, animation, and still bitmap or vector images with code, all make Flash a very interesting tool for designers who are disillusioned with DHTML, which simply does not deliver the promised goods. Why should designers be focusing on inventing ways to work around the incompatibilities between various DHTML implementations?

One of the reasons for Flashs popularity is the fact that it provides what other standards cannot provide: an easy way for the designers to control the final look of the documents they publish on the Web. It is, in a way, the PDF of the interactive multimedia. Both formats are so popular because, for the end user, the efforts that go into achieving the desired results are minimal.

Final Thoughts

SVG is in many ways superior to Flash, but it has not achieved the critical mass, yet, mainly because it still waits for an authoring application to match Flash MX. Flash on the other hand, has the marketshare SVG needs, but could benefit from many solutions found in SVG. It is inevitable that they will borrow the best ideas from each other at some time in the future. And it will be beneficial to everyone.

Today, the enterprise user has a choice of SVG or Flash and neither is a bad one. I'd say that it's a draw between the two and only the future can tell which one wins.

Jacek Artymiak started his adventure with computers in 1986 with Sinclair ZX Spectrum. He's been using various commercial and Open Source Unix systems since 1991. Today, Jacek runs devGuide.net, writes and teaches about Open Source software and security, and tries to make things happen.


Return to the Web Development DevCenter.