Posted on

Embed SWF

SWF EMBED GALLERY LOADER:
This is the most cross browser compatible solution I have come up with thus far: ditch the object tag.
EmbedSWF resizes the target container, adds an optional background, then uses an innerHTML rewrite to populate it with the proper embed tag.
HTML: <div id=”swfbox”><!‐‐ swf gets inserted here by EmbedSWF ‐‐></div>

USEAGE: Specify the target ID, the full path to the swf file, width, height, optional background, and optional FlashVars:
EmbedSWF(‘targetID’,’../mymedia/NewFile.swf’,600,400,’#000′,’file=this&buffertime=that&variable=something’);
Use a set of empty quotes for the background if you want to leave it blank but still include FlashVars, otherwise both are optional.

To have the page initialize with a file pre-loaded, place a script in a hidden p tag above the target div (if excluded, div content will show):
<p style=”display:none;”><script type=”text/javascript”>EmbedSWF(‘targetID’,’../mymedia/NewFile.swf’,600,400,’#000′,’file=this&buffertime=that&variable=something’);</script></p>
AND/OR include multiple links to load more swf files by placing script calls inside of link tags:
<p><a href=”#” onclick=”EmbedSWF(‘targetID’,’../mymedia/NewFile.swf’,600,400,’#000′,’file=this&buffertime=that&variable=something’);”>Load SWF</a></p>

SCRIPT:
function EmbedSWF(t,p,w,h,b,v){
if (b==null) {b=’none’};
document.getElementById(t).style.width=w+”px”; document.getElementById(t).style.height=h+”px”; document.getElementById(t).style.background=b;
document.getElementById(t).innerHTML=”<embed width=’100%’ height=’100%’ src=”+p+” type=’application/x-shockwave-flash’ quality=’high’ wmode=’transparent’ align=’center’ allowscriptaccess=’always’ allowfullscreen=’true’ pluginspage=’http://www.adobe.com/go/getflashplayer/’ FlashVars='”+v+”‘></embed>”;
}

Here I’m using swf game files as an example


Choose A File!

Posted on

Embed MP3ep

This is a variant of EmbedSWF to accomodate a Flash mp3 player that loads playlists.
EmbedMP3ep resizes the target container, then uses an innerHTML rewrite to populate it with the proper embed tag.
Requires a copy of ep_player.swf and skins in the same folder. Playlists should specify full paths to mp3 and thumbnail image files.

USEAGE: Specify the target div, the path to the player’s FOLDER, the path to the playlist FILE, width, and height:
EmbedMP3ep(‘targetDiv’,’../files/playerFOLDER’,’../files/playlists/playlist.xml’,269,226);
Other variables like autoplay, shuffle, and repeat can also be set in embedmp3ep.js file.

To have the page initialize with a playlist pre-loaded, place a script in a hidden p tag above the target div (if excluded, div content will show):
<p style=”display:none;”><script type=”text/javascript”>EmbedMP3ep(‘targetDiv’,’../files/playerFOLDER’,’../files/playlists/playlist.xml’,269,226);</script></p>
AND/OR include multiple links to load more playlists by placing script calls inside of link tags:
<p><a href=”#” onclick=”EmbedMP3ep(‘targetDiv’,’../files/playerFOLDER’,’../files/playlists/playlist.xml’,269,226);”>Load Playlist</a></p>


Choose A Playlist!

Posted on

Embed FLV

This is a variant of EmbedSWF designed to load flv videos in a page.
EmbedFLV resizes the target container, then uses an innerHTML rewrite to populate it with the proper embed tag.
Requires a copy of mediaplayer.swf.

USEAGE: Specify the target div, the full path to the player, the flv file path relative to the PLAYER, width, and height:
EmbedFLV(‘targetDiv’,’../mediapath/mediaplayer.swf’,’../videos/VideoName.flv’,720,400);
The target’s background is automatically reset to black when a file is loaded.

To have the page initialize with a video pre-loaded, place a script in a hidden p tag above the target div (if excluded, div content will show):
<p style=”display:none;”><script type=”text/javascript”>EmbedFLV(‘targetDiv’,’../mediapath/mediaplayer.swf’,’../videos/VideoName.flv’,720,450);</script></p>
AND/OR include multiple links to load more flv files by placing script calls inside of link tags:
<p><a href=”#top” onclick=”EmbedFLV(‘targetDiv’,’../mediapath/mediaplayer.swf’,’VideoName.flv’,720,450);”>Load Video</a></p>

Test videos are old episodes of Lost Untangled:
504 | 505 | 506 | 507

Choose a video