PDA

View Full Version : Loading a swf file into a div (photo gallery)



kpsony
08-28-2008, 11:20 PM
So, I have a photo gallery with a specific div where i'm loading images. One of the images needs to be animated, so I cannot just link a jpeg, i have to use a swf so the image can scroll. For some reason when i replace the imagexx.jpg with imagexx.swf I get a red x. Is this even possible to do?


Here's the code for my div:


<div style="overflow:hidden;">
<div id="motioncontainer" style="width:207px; height:435px; overflow:hidden; position: relative;">
<div id="motiongallery" style="position:absolute; left:0; top:0;">


And heres the code I have for my images that are loading into that div:

<a href="images/image.swf" rel="enlargeimage::click" rev="loadarea::#"><img name="" src="images/new_additions/1.jpg" width="207" height="123" border="0" class="gradualfader"></a><br><br>


What am I doing wrong? Thanks!!!

Nile
08-28-2008, 11:21 PM
A swoof file is not an image, it is a flash file. Try using an animated gif.

kpsony
08-29-2008, 09:44 PM
i cant. The iamge has to be animated. Im sure there is a way to do it.

kpsony
08-29-2008, 10:01 PM
I found some code that opens the flash on page load, but i have no idea how to add the function to a link so the flash will only load when the link is clicked. ideas? see code below:




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Captivate-to-Flash ExternalInterface example</title>
<script type="text/javascript" src="scripts/swfobject.js"></script>
<script type="text/javascript">
function addFlash(){
var so = new SWFObject("images/series_test.swf", "mov1", "640", "480", "8", "#FFFFFF");
so.write("flashContainer");
}
window.onload=function(){
addFlash();
}
</script>

<!-- for Flash-JS communication -->
<script language="JavaScript">

//Detect Flash container movie
function getFlashMovie(mov1) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[mov1];
}
else {
return document[mov1];
}
}

//Function to be called by Captivate
function captivateUnload() {

//Calls "unload" method established in ExternalInterface Actionscript code
getFlashMovie("simpleSwfLoader").unload();

}


</script>

</head>

<body>

<div id="flashContainer">If you see this message, you have Javascript disabled. Please enable Javascript to see the Flash content.</div>
</body>

</html>