Stylehack

XHTML Validation & Flash Movies

One of the hurdles Web Coding Standaristas place in a Flash Animator’s path is that of validation — the way that Flash movies have historically been inserted into web pages does not conform to current W3C standards. Boo hoo. “-) A couple of years ago I stumbled across the article on ALA re the Satay Method of inserting a Flash movie so that the page will still validate. It was a great article, contained a plethora of information on who/what/when/where/why and how the author had arrived at the method as it was explained at that time, and where the author felt it still needed work. To my mind the operative word was “work”… there was too much of it involved. If the visitor can find my site/page, he/she can accept some responsibility for taking the extra steps necessary to view all the content if it’s really that important to them. So I decided then and there to get rid of all the extra “stuff” in the Satay post and use only the bare basics that I felt were necessary to meet some specific considerations:
1. Valid coding practice 2. Meet basic Accessibility Standards 3. Provide a solution to the visitor without the Flash plugin or who has (gasp) blocked the play of Flash animation
Mostly, though, I decided to do this to impress and awe my pal Farron. She’s a web standards worshipper.. er I mean Web Standards Coding Instructor [whipping head around in fear to make sure she's not reading this!]. “Impress and awe” is defined in Stylehack-speak as “Prove it can be done”. “-) Selecting the level of Standards To cover future bases as much as possible, I decided to aim for validating to XHTML 1.0 Strict. The same practices will work at other levels… XHTML 1.0 Trans and I think HTML 4.01 also, though it’s been so long since I coded that way I could be wrong. Here is the DOCTYPE declaration for an XHTML 1.0 Strict document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
You’ll notice I left off the XML declaration… I’ve had trouble with it tossing one browser or another into Quirks mode, so I include it only sparingly.
<?xml version="1.0" encoding="iso-8859-1"?>
Defining the OBJECT Tag There are many great discussions and how-tos on the web that discuss the merits of just about every topic, including the use of the OBJECT tag that is used to insert a Flash animation. So I’m not going to go into that here, I’m simply going to give you an example of how I insert a movie and explain my logic (or lack thereof).
1 <object type="application/x-shockwave-flash" data="myMovie.swf" width="431" height="68">
2 <param name="movie" value="myMovie.swf" />
3 <param name="BGCOLOR" value="#000000" />
4 <a title="You must install the Flash Plugin for your Browser in order to view this movie"  href="http://www.macromedia.com/shockwave/download/alternates/"><img src="needplugin.gif" width="431" height="68"  alt="placeholder for flash movie" /></a>
5 </object>
Note: The above code example should not have a hard return in it breaking what was one line into many lines (line 4); this example was allowed to wrap for purposes of presentation, so there you go. Obviously, it will not have actual line numbers when you recreate it. “-)
Line 1:  The only variables on this line are the name of your movie and its dimensions. Do NOT remove the ” (apostrophes) around the name of the movie nor its dimensions; Line 2:  This param (Name) is required for cross-browser compatibility. (Don’t get me started on my IE-is-bad and FF-is-the-IE-of-Geek-Wannabes rant! Good thing I shut off comments here. grin) Anyway, the name you put here must match the name in Line 1. Again, don’t remove the ” (apostrophes);
Note: Lines 1 and 2 replace the old OBJECT/EMBED combo used to address how various browsers have accessed Flash movies in the past.
Line 3:  An optional line; there could actually be more params used than are used in this example, any that are considered valid for the OBJECT tag can be defined as necessary and applicable; Line 4:  This is the line that addresses missing plugins, browsers where animation is shut off and older browsers that can’t do the Flash movie thing. On top of which, it adds a level of accessibility to your movie for visitors using a Text Reader. It’s a work of art. “-) Basically, you need 3 things here….
a) An image to replace your movie. It can be a screen shot of your movie, or an image that informs the viewer they need a plugin to view the movie. To prevent any problems with your page design, you should make this image the same size as the movie; b) A destination URL where your visitors can get the Flash plugin, if necessary. In the example above, I have used the link to the page on the Macromedia site that offers download links for plugins to fit a variety of operating systems and/or browsers. These links change from time to time, so you need to remember to check them every now and then. Another option would be to make this link to a page on your site that then offers a link to Macromedia; if you have a lot of movies on your site, it would be easier to update the link on that page rather than a bunch of static page links. Of course, if you use a dynamic method of site generation, like PHP, this could be a variable so you only have to change a single declaration to impact your site. I’m getting offtopic, right? “-) c) Appropriate ALT and TITLE tags for your page, both for accessibility and clarity.
The implementation of these 3 items is EaSy PeAsY, as debbieT says! Simply wrap the image in an A tag (hyperlink). See? That wasn’t hard at all. Why do it?   When a visitor doesn’t have the Flash player (or has shut off Flash animation) their browser will display the image declared in this line. When they roll their mouse cursor over the image, the TITLE will pop up so they can read your instructions/comments. If they have images shut off, they will also see the ALT tag. Clicking on the image/link will send them to the Macromedia site so they can get the appropriate plugin. Whether you use an image with words (”You need the Flash Player to see my movie!”) or a screen capture of your movie, you need to be sure to use clearly thought out TITLE and ALT text. This is good practice for you for accessibility purposes… they should not be the same, but should work together in some way to describe an object or — in this case — also pass on information. Line 5:  Don’t forget to close the OBJECT tag. Summary Believe it or not, this is all you need! The movie plays or the image is displayed. And best of all, it validates as XHTML 1.0 Strict! Of course, you will have to insert this bit of code into a valid structure… it can be put in a DIV or a P, for instance. Please keep in mind that if you are using Flash MX 2004 and that blasted sniffer publishing method, you will need to fiddle this information a bit. I personally don’t like sniffers, so that’s not an issue for me. What’s that?  You want to know if there is an easy way to gather the info about your movie and the params you normally used? Sure! Simply do the Flash export/publish to HTML thing, then use that as a source of info to create your own OBJECT tag in your page. Slacker’s Rule #472. “-) And that concludes today’s Blah blah, car ride. (What another of daHens — Butzi — calls my “discussions”. hehe) Footnote 1: There are several geniuses who have come up with this stripped down method in the last year and wrote it up on their blogs; this article is not based on their publishing. I was using it long before they “published” and simply put off writing it up for our Flash and Swish classes - not to mention the Build a Website classes - because I am ~The~ Slacker! Just for the record. Footnote 2: This method is not recommended for a gigantic movie without a proper preloader sequence and planning, nor is it the best way to handle streaming Flash animations. For that, there is another trick that is part of the complete Satay Method using a 1×1 empty movie as a sniffer. Footnote 3: Farron’s blog is called Catartis. I only referenced her “other” site above because I wanted to harrass her a bit. hehe. For the record, the other daHens (Butzi, debbieT and Liann - in alphabetical order) are available by link up on the right.

[ZC] Zen Cart Contribution : Event Lister

Filed under:
I’ve finished the Event Lister contribution for Zen Cart and released “2005-03-19 R 1.0″ in place of the earlier RC2 (Beta, release candidate 2). If you’re looking for the Event Lister, and didn’t follow the link in the latest post of the Event Lister thread at the Zen Cart forum, you can find the new zip here: http://www.stylehack.com/tutorials/downloads/event_lister_r1.zip It also contains the modification to use it in conjunction with the News Manager 1.5 contribution by Dave @ Open Operations. Please read the readme file in the zip before using this mod. “-)

Oh boy! Learn Flash & Swish Online!

Hurry boys & girls! You still have time to enroll in the next session of our popular Flash animation, Flash Action Script and Swish classes at LVSOnline! For information on each class and the syllabus, please use the links below: Flash 5 (Self-study)     Introduction     Intermediate Flash MX (Instructor-led)     Introduction     Intermediate     Advanced Flash MX 2004 (Instructor-led, unless otherwise noted)     What’s New in Flash MX 2004 ** Self-study     Introduction     Intermediate     Advanced Flash 5, MX and MX 2004 (Instructor-led)     Flash FX Part 1 (Animation Effects)     Flash FX Part 2 (Animation Effects)     **Coming Sept 2005: Flash FX Part 3 (Animation Effects)! Action Script for Flash 5, MX and MX 2004 (Instructor-led)     Introduction to ActionScript Part 1     Introduction to ActionScript Part 2 SwiSH2 (Instructor-led)     Introduction to SwiSH2 Animation And keep an eye out for other new classes we have planned…. Flash Cartooning, SwiSH2 Intermediate, SwiSH Max — Intro and Intermediate. I’ve also been playing with some ideas for short, selective-type courses in using cPanel, Installing & Configuring a local Apache Server, Opera and Web-accessibility (check out the Voice features in the Opera 8 BETA!), and maybe skinning blogs or something along that line. If you have any requests, feel free to email me: becky[at]stylehack.com [rolling eyes at pathetic attempt to hide from spammers]

WordPress 1.5 is Here!

Filed under:
The long awaited version of WordPress with an Admin Dashboard is here! And it’s so much more… wow. Just a quick overview of the enhancements I know I’ll make use of:      Whitelisting Approved Commentors (it’s automatic!)      Blacklisting Spammers (goodbye Poker posters)      Ability to add a normal web page to WP      Enhanced Templating System And just in time… I have a client for which I was starting to mull over what CMS might work, just need a simple system for her, nothing fancy. YES. WordPress will do very nicely. And I think I might fix my sloppy design and hacked template for this new version, maybe even redesign things. Yeah, I don’t need a whole 6 hours of sleep a day… “-) Get the new WP here:   http://wordpress.org/development/2005/02/strayhorn/

Stylehack © 2008 - Becky Peters :: All Rights Reserved
Powered by WordPress