Unobtrusive Flasher

This loads Flash movies using SWFObject, but it puts all the options into a hidden input element.

Requirements

Download

Get the file by downloading: flasher.js

Instructions

  1. Download the file and save to your website.
  2. Include the SWFObject library file.
  3. Include the MooTools library (if you haven’t already)
  4. Include the flasher.js file.
  5. Make a <div> element for each movie you want to embed, with optional alternate content.
  6. Put a hidden input field inside each div with a "flasher" class, and the options you want the movie to use.

Example

For example, this could be the HTML for your site:

<html>
<head>
	<script type="text/javascript" src="/js/swfobject-2.2.js"></script>
	<script type="text/javascript" src="/js/mootools-1.2.3-core-yc.js"></script>
	<script type="text/javascript" src="/js/flasher.js"></script>
</head>
<body>
	<div id="mymovie">
		<input class="flasher" type="hidden" value="{
			url: '/swf/mymovie.swf',
			params: {
				quality: 'high',
				wmode: 'transparent',
				base: '/'
			}
		}" />
	</div>
</body>
</html>

Options

Same as the SWFObject options, but with these additional ones:

  • url: location of the .swf file, required
  • width: width of movie, defaults to 320
  • height: height of movie, defaults to 240
  • version: Flash version, defaults to 9.0.0

License

“Have Your Way With It™” — MIT License

Comments