I'm trying to build a simple gallery using some thumbnail images to load larger images and SWF files by swapping out the source hrefs. It works okay with images, but I'm having trouble doing the same thing with SWFs (Note: Both galleries exist on separate pages so there is no confusion.) Here is the function that works on the image gallery page:
I tried adapting it for the Flash gallery page like this (Note: In preview post, I'm seeing a big space on line 6 between the 'mo' and 'vie' in after setAttribute. This is a weird formatting error that caused by the forum, and doesn't exist inside my code.):
I'm implementing my SWFs using the Flash Satay method which strips out the embed tag because it's not W3C compliant.
Thumbnail link that calls the function:
What I want to happen:
When the thumbnail is clicked, the SWF with the ID 'placeholder' should be replaced with the SWF referenced in the thumbnail link, so the old SWF file is "swapped" for the new one.
What actually happens:
When the thumbnail is clicked, a page containing only the SWF is loaded in full frame.
Here's an example of the working image gallery on my site.
Thanks in advance.
Code:
function showPic (whichpic)
{
if (document.getElementById)
{
document.getElementById('placeholder').src = whichpic.href;
}
return false;
}
Code:
function showFlash (whichFlash)
{
if(getElementByID)
{
document.getElementByID('placeholder').data = whichFlash.href;
document.getElementById('swfsrc').setAttribute('movie', whichFlash.href);
}
return false;
}
Code:
<object
id="placeholder"
type="application/x-shockwave-flash"
data="../media/dresscat.swf"
width="700" height="300">
<param name="movie" value="../media/dresscat.swf" id="swfsrc" />
</object>
Code:
<a onclick="return showFlash(this)" href="../media/mia_flash_gallery.swf">image</a>
When the thumbnail is clicked, the SWF with the ID 'placeholder' should be replaced with the SWF referenced in the thumbnail link, so the old SWF file is "swapped" for the new one.
What actually happens:
When the thumbnail is clicked, a page containing only the SWF is loaded in full frame.
Here's an example of the working image gallery on my site.
Thanks in advance.
Comment