====== Embedding Flash in HTML ====== This page talks about how to embed a Flash component in a HTML page. ===== Manual Approach ===== Here's a [[http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_12701|more in-depth technote from Adobe]] about manual embedding. ===== JavaScript Assisted Approach ===== This approach uses a third-party javascript library to help in generating the HTML tags. This saves you from a lot of complexity you might otherwise have to deal with : * There's less code (you don't write the tags yourself) * Automatic upgrades (and upgrade checks) using Express Install. * Graceful degradation in case there's no javascript of Flash support. An excellent example of such a library is [[http://blog.deconcept.com/swfobject|SWFObject]]. The examples on this page will be about SWFObject. Express Install allows Flash (from Flash Player 6 on) to automatically perform an update. This update takes place inside the flash player itself and doesn't redirect to the macromedia site. More information [[http://blog.deconcept.com/2005/08/13/using-flash-player-express-install-with-flashobject|here]]. If there is no javascript or Flash support, nothing happens and the user sees a default message. ==== 1. Add JS Library ==== Add this to the head-tag. ==== 2. Decide where the component should go ==== The way swfobject works is by replacing a pre-existing HTML element with the flash embedding code. The default content of this HTML element is used as a fallback. If javascript and flash are present, this HTLM element remains and is displayed to the user. Determine where you want the flash component to be and add an element there. Give it an ''id'' attribute with a value identifying the element.
Your browser doesn't support JavaScript. Please enable it to view this content!
==== 3. Let SWFObject add the component ==== The following example adds the flash component to the element identified by 'ofmContent' and makes the flash component available as 'ofmContentReference'. Complete example :
Your browser doesn't support JavaScript. Please enable it to view this content!