Flashembed and jQuery
Embedding multiple Flash objects
Flashembed has support for jQuery. This means that it can work as both a standalone script and as a jQuery plugin. You can use jQuery selectors to select elements from the page and place Flash object inside them. In this example we will find three div elements with the class name "clock" and place a SWF-based clock inside them:
HTML Setup
Our HTML setup is plain and simple:
JavaScript code
All those clocks were installed with this one jQuery call:
Those clocks were positioned side-by-side using CSS.
SIFR example
In this example, we show you how we can install multiple Flash objects with one call but each object is configured differently. We use the quite popular SIFR methodology to replace the header text with Flash to provide a smoother typographical experience. We do not encourage using this method because today's browsers render fonts much better than they used to. However, this is a great example that shows you how to use jQuery and flashembed together.
standalone demoHTML code
We have normal h3 tags and they have been given the class name "sifr". Non-Flash browsers will see these headers normally, but Flash-enabled browsers will see the headers with the Flash-based text which is fully anti-aliased.
SIFR is a rather old school technique, but serves as a good flashembed example.
JavaScript code
The code loops through the h3 tags and places a Flash object inside each one. Each object is configured separately with the HTML code that is provided inside the header tag.
Additionally, there are some CSS settings to set dimensions for the h3 tags.