Jump to Content
  • Journal
  • Portfolio
  • Projects
  • About
  • Contact

Kimili Flash Embed - WordPress Edition

22 Feb 05

Update! 2.25.05
There’s a new version of the Kimili Flash Embed – Wordpress Edition available. Get it while it’s hot.

Update! 2.22.05
If some of you have been having problems embedding, we are guilty of a very silly oversight. The way we were parsing out the <kml_flashembed> tag was incorrect. Please re-download the zip and re-install the plugin. All should be good now.

The original version of Kimili Flash Embed is a Textpattern plugin which gives an easy interface to Geoff Stearns’ flash detection and embedding javascript. With the plugin, one can put a simple tag into an article instead of having to drop in a chunk of Javascript to display flash content.

Using Geoff’s script to display flash content has many advantages over other methods, including flash player version detection, serving up alternate content if needed, bypassing incorrect player detection and standards compliance.

When I approached Geoff about doing the plugin for Textpattern, he was very cool about it. He then told me that he uses WordPress to manage his blog and asked me about the possibility of porting the plugin to a WP version. After some trial and error, here it is.

  • kml_flashembed_wp.zip (5.94KB)
    Get the latest version, always available at the KFE Home.

In the zip you’ll find the following files:

  • flashobject.js – this is Geoff’s script
  • kml_flashembed.php – the WordPress plugin
  • readme.txt – usage instructions

Usage

Using this plugin is practically identical whether you are running Textpattern or WordPress.

The first thing to do is make the script available to any page you’d like to place flash content on. Put flashobject.js in a folder called js off of the root of the site. Then add the following line of code in the head of your page templates:

=<pre><script language="JavaScript" type="text/javascript" src="/js/flashobject.js"></script></pre>=

After you’ve done that, just drop the kml_flashembed.php file into your wp-content/plugins directory and activate the plugin. Now you can add Flash content to your pages using a tag like this in your articles:

=<pre><kml_flashembed movie="filename.swf" height="150" width="300" ></kml_flashembed></pre>=

It is important to double quote your attributes in this tag. Single quoting may trip things up a bit.

The available attributes for the <kml_flashembed /> tag are:

movie (_required_)
The path and file name of the flash movie you want to display.

height (_required_)
The height of the flash movie. You can specify in pixels using just a number or percentage.

width (_required_)
The widthof the flash movie. You can specify in pixels using just a number or percentage.

align
(l, t, r, b) – Left, Right, Top, and Bottom align the movie along the corresponding edge of the browser window and crop the remaining three sides as needed. Defaults to centered.

alttext
The text or HTML you want to display if the required flash player is not found. If you want to use HTML inside this attribute, there are some important differences to remember, as we’re inside of another tag. Specifically:

  • Use curly brackets: {p} for tags instead of normal braces: <p>
  • Use single quotes for HTML tag attributes, as your kml_flashembed attributes should be double quoted.
  • Example Syntax: alttext="{img src='noflash.jpg' alt='You need flash' /}"

bgcolor
(#RRGGBB, hexadecimal RGB value) – Specifies the background color of the Flash movie.

fvars
Pass variables (name/value pairs) into your movie with this attribute. You can pass in as few or as many variables as you want, and they can be hard coded or PHP variables. Syntax is as follows and the spaces are optional:

  • fvars=" name = value ; name = value "

fversion
You can specify what version of the flash player is required to play your movie. Defaults to 6.

id
You can give your movie a unique id on the page for scripting purposes.

loop
(true, false) – Specifies whether the movie repeats indefinitely or stops when it reaches the last frame. The default value is true if this attribute is omitted.

menu

  • (true) displays the full menu, allowing the user a variety of options to enhance or control playback.
  • (false) displays a menu that contains only the Settings option and the About Flash option.

noscript
Text or html content you would like to display to users browsing on a non-javascript browser or with javascript disabled.

play
(true, false) – Specifies whether the movie begins playing immediately on loading in the browser. The default is true.

quality
(low, high, autolow, autohigh, best ) – Specifies the playback quality of the Flash movie.

salign
(l, t, r, b, tl, tr, bl, br) – Specifies which edge or corner the movie is aligned to in the browser window while and cropping the remaining sides as needed.

scale
(showall, noborder, exactfit) – Dictates how the movie fills in the specified target area.

target
This is the ID of an element on your page that you want your flash movie to display within.

wmode
(window, opaque, transparent) – Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser.

You can find out more about Flash player attributes here

Comments

whoo says:
1592 days ago ∞

wordpress 1.2.3, doesnt work :(

abjdiat says:
1592 days ago ∞

is there any way to using this embed in html directly?....

Michael Bester says:
1592 days ago ∞

Whoo – I developed and tested this plugin on WP 1.2.2. I’m not sure why it wouldn’t work on 1.2.3. Can you be more specific about the issues you’re having?

Abjdiat – As it is now, this plugin only works in article posts. I’ll look into updating it so it can be used anywhere within the WP environment.

Jeff Minard says:
1590 days ago ∞

This could be spliced into a single PHP file. I have a plugin that makes Live comment previews and it uses JS too, but instead of focing people to download/upload/insert an extra JS file, the plugin does it for them.

Just check out the source code, I thought it was a neat idea.

Michael Bester says:
1590 days ago ∞

Jeff – That’s fantastic!

I’ll add that functionality to an updated release of this plugin. With it set up this way, users could just unzip the package into their plugins directory and be done with it. Thanks!

Jeff Minard says:
1590 days ago ∞

Sure thing :D I’ll probably end up using this too, so it behooves me ;)

david ehlers says:
1563 days ago ∞

do i need this to add flash to my blog?

Michael Bester says:
1563 days ago ∞

David – This plugin makes adding flash movies to your blog entries very easy. You’ll want to try the updated version of the plugin though. It’s even easier to install than the one on this page.

David Ehlers says:
1562 days ago ∞

Great.

Do you have a sample file I can view, I makes the area, but doesn’t load the movie.

I noticed the description in the plugin page cpanel has a slight error:

“Provides a wordpress interface for Geoff Stearns’ excellent standards compliant Flash detection and embedding JavaScript. The syntax is .”

The last tag is missing the “kml_” -

flash intro guy says:
1552 days ago ∞

Looks very nice. Is there some significant advantage besides saving a few lines of code. Normally you won’t publish lots of flash banners or other SWF files on a page. I may give it a try though. Thanks.

Michael Bester says:
1552 days ago ∞

flash intro guy – The advantages of using this script are much more than saving a few lines of code. I outlined them in my original post about the Kimili Flash Embed. Although that post refers to the Textpattern version of the plugin, the functionality and benefits are the same as the WordPress edition.

Michael Bester says:
1541 days ago ∞

If you have any questions or would like to leave a comment, please refer to the updated version of this plugin.

Comments closed.


Flickr

  • Practice, Practice, Practice
  • Practice, Practice, Practice
  • Rose Star
  • Ostrich
  • What Are You Looking At?
  • Mandrill
  • Peace Poll

See more at Flickr

Recent Listening

  1. Robert Johnson: The Complete Recordings
  2. Tom Waits: Real Gone
  3. Charlie Parker - Bird's Best Bop on Verve
  4. Charlie Parker - Best of The Complete Savoy & Dial Studio Recordings
  5. The Beatles - Abbey Road
  6. Sérgio & Odair Assad – Latin American Music For Two Guitars
  7. Björk - Medúlla
  8. Erykah Badu - Baduizm
  9. Ali Farka Touré: Savane

See more at Last.fm

Tweet, Tweet

  • I SOOOO need to get myself an office. #workingFromHomeIsFun 7 hours ago
  • Sweet typographic design: <a href=“http://finaleyes.org.

    Reminds”>http://finaleyes.org.

    Reminds me of my site, http://kimili.com, but better. (via @meaganfisher via @weightshift)
    1 day ago
  • That last thunderbolt rocked the house! Must’ve been right around the corner. 1 day ago
  • @arockalypse I’m jealous. La Dolce Vita, indeed. 1 day ago
  • Gotta keep practicing. http://www.flickr.com/photos/m… 3 days ago

See more at Twitter

©MMII – MMVIX Michael Bester