View Full Version : Drop down menu for Flash object

02-29-2008, 05:22 AM
I would like to create a drop down menu similar to the one that displays images as in:


But rather than for images, I would like it to open and display also flash object on the one webpage from the drop down menu.

Can this be done? and if so anyone give me some hints on how to code it.

I have tried to replace the image name (heart.jpg) with the flash object name (animation.swf) but this did not work.

Thanks in advance.

02-29-2008, 05:49 AM
Here try this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
function showAnimation(what)
var flashfile = what.split(',')[0]+'.swf';
var width = what.split(',')[1];
var height = what.split(',')[2];
var so = new SWFObject(flashfile, "mymovie", width, height, "8", "#FFFFFF");
window.onload = function()

<form action="#" method="post">
<select name="flash" id="flash" size="1" onChange="showAnimation(this.options[this.selectedIndex].value)">
<!--the value of each option contains three items separated by a comma, flash file name (no extension), width, height-->
<option selected value="animation1,100,100" selected="selected">Animation 1</option>
<option selected value="animation2,50,75">Animation 2</option>
<option selected value="animation3,75,100">Animation 3</option>
<div id="flashcontent">A flash animation should appear here</div>
Attached are the files you need. swfoject.js comes from http://blog.deconcept.com/swfobject/ so if you need to parameters or something read the documentation.