I am simply trying to pass a value to flash and really struggling to get it working.
Here is my setup.
JAVASCRIPT FUNCTION
[COLOR=“DarkRed”]<script type=“text/javascript”>
function passImage(url) {
window.document.movie.SetVariable(“image”, url);
window.alert(url)
}
</script>[/COLOR]
FLASH FILE OUTPUTTED USING SWF OBJECT
[COLOR=“DarkRed”]<script type=“text/javascript”>
var so = new SWFObject(“swf/image.swf”, “movie”, “300”, “300”, “6”, “#ffffff”);
so.addParam(“swLiveConnect”, “true”);
so.addParam(“allowScriptAccess”, “sameDomain”);
so.addParam(“quality”, “high”);
so.addParam(“scale”, “noscale”);
so.addParam(“loop”, “false”);
so.addParam(“wmode”, “transparent”);
so.addVariable(“image”, “01.jpg”)
so.write(“flash”);
</script>[/COLOR]
HTML TO LAUNCH JAVASCRIPT FUNCTION
[COLOR=“DarkRed”]<dl id=“dlQuickLinks”>
<dt>FEATURED IMAGES:</dt>
<dd><a href="#" onclick=“passImage(‘01.jpg’); return false;”>Image One</a></dd>
<dd><a href="#" onclick=“passImage(‘02.jpg’); return false;”>Image Two</a></dd>
<dd><a href="#" onclick=“passImage(‘03.jpg’); return false;”>Image Three</a></dd>
</dl>[/COLOR]
All seems fine to me but for some reason the file is not being changed on the fly as it should. Can anyone spot the mistake I am doing here?
What is suppose to happen is that when you click Image One then the variable via flash will change and the image will change accordingly. I can do it using a querystring i.e [COLOR=“DarkRed”]index.asp?image=04.jpg[/COLOR] but not using javascript.
WHY DO I WANT TO USE JAVASCRIPT?
Prevents a page refresh.
I would really appreciate any links, advice or help as I am burnt out with searching the web and attempting to find my error alone. Any guidance greatly appreciated.
Many thanks
Trevor