Dual Design: Maintaining Consistent Flash and Html Pages
Ken Goldberg and Guy Boo, UC Berkeley, September 2005
Goal: make a home page with the design and display features of Flash
without sacrificing the benefits of vanilla HTML.
Criteria
- Maintainability. HTML is very easy to edit and update: the solution should not be more complicated.
- Searchability. It's important that the page, its contents and links, appear on search engines, so the solution must allow web crawlers to examine the data.
- Compatibility. Not everyone has Flash or the latest display tools, and the solution must work with as many browswer and printer configurations as possible.
Our Solution
All updates are made to a single XML file structured according to a
specialized protocol we designed. Whenever we update the XML, we run
a Perl script that interprets it and creates new versions of the HTML
and flash pages. The updated index.html is available for web crawlers,
browsers that don't have Flash, and anyone who wants to print a
hardcopy.
For browsers that support Flash, the flash version of the site
downloads, parses, and plays the content.xml file on the fly when it
is downloaded. We use Flash's native XML class to download and parse
the source file, MovieClip class to load any needed images and manage
and animate elements onscreen, and TextField class to display and
animate text and display small snippets of HTML.
Examples
Resources
- to learn more about the perl parser, contact ken at goldberg dot net
- You need Perl with its XML::Parser module to run this script.
- The parser README
- Instructions for how to use the parser, and a detailed explanation of our XML protocol
- Abridged Readme
- A highly summarized, but straightforward, document explaining how to get started using the parsers.
- The .fla file (192 kB)
- The Flash document used to code and publish the flash parser - might be readable only by Flash MX Professional 2004
- XML::Parser
- The perl module that provides the actual XML parsing routines for our script. It does not yet come as part of a standard Perl installation, so you almost certainly need to install it to run our script.
- Expat
- The C library that the Perl XML::Parser module runs on. If you want to run the script, you'll probably have to install this. (You'll know if the build of the XML::Parser module fails.)
Further Research
- The Macromedia Flash help files
- Useful to gain a basic familiarity of Flash.
- The Macromedia ActionScript API (accessible from the previous link)
- Indispensable resource when tackling ActionScript.
- www.kirupa.com
- An extremely useful resource for learning about Flash, ActionScript, and XML with an emphasis on coding.
- Schwartz, Randal L. and Christiansen, Tom. Learning Perl. 2nd ed. O'Reilly & Associates, Inc. 1997.
- A decent, easy to read primer that covers almost everything you need to know to write the parser. Get the latest edition you can find, the earlier ones have less content.
- The Perl man pages: perlref, perlintro, perlsub, perltoc...
- The complete and unabridged guides to the Perl language. After reading Learning Perl, perlref is particularly useful as it covers a great deal of new territory. (Enter 'man man' on the command line to learn how to read man pages, or to see if your system even supports them or has any.)
- Contact: Ken Goldberg ken at goldberg dot net
- Please let us know if this is useful or if you have improvements!
We put this online as a resoure and regret that we can't provide
detailed support, help debug code etc....