Struggle with some basic Java Script

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

Don’t think this is possible… Why don’t you just remove the flash thing all together? Just have <img> and you can easily change the imc src on the fly without page refresh…

Thanks for your reply.

This is basically to load different flv files into flash using javascript.

The demonstration below is just a quick demonstration. I am 99% sure it is possible as they do it on the CNN website but I cannot for the life of me figure it all out.

Anyone else help me out?

Sorry I can’t help more. I don’t know about flash. :frowning:

I’d throw an interval into flash that checks a certain variable in the address bar. If it is the same as the temp variable, leave it the way it is. Yet, if the variable has changed, take that variable value down instead. I’d assume it would have to be a variable in your params that would need to be changed. There must be a way to change the query string without refreshing the page.

Just throwing that out there.