Member
From: Nashville TN
Registered: 2007-08-30
Posts: 82
I've been thanked 1 times.
Offline
Hi y'all,
I would like to have an .swf Flash movie loop endlessly on my home page. All this file does is play a slide show of certain lifestyle-related .jpg's relevant to my site. The .jpg's have a fade/wipe style transition from one to the next. You can see an example of this at http://www.picnictime.com/.
Since I don't really understand how the programmers are displaying the Flash movie on the picnictime site, I've created a .swf file and let the Adobe Flash software create the HTML for it. What I don't like is having all that HTML related to the .swf on my page. I would love to be able to have just a single HTML line on my page that simply references the .swf HTML which would be stored on a separate HTML page. A similar concept is using CSS to keep style-related code out of your HTML. Only this one would be trying to keep .swf-related code out of my HTML. Oh yeah, I would like to restrict this solution to client-side scripting if at all possible. I don't know enough about PHP yet to have this work with server-side scripting.
Here's the code that my Adobe Flash created. I think you'll see why I don't want to "clutter" my HTML with it.
Code: html
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>BasketIntro</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '480',
'height', '360',
'src', 'BasketIntro',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'BasketIntro',
'bgcolor', '#ffffff',
'name', 'BasketIntro',
'menu', 'false',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'BasketIntro',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="480" height="360" id="BasketIntro" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="BasketIntro.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="BasketIntro.swf" quality="high" bgcolor="#ffffff" width="480" height="360" name="BasketIntro" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>
Administrator
From: Colorado, USA
Registered: 2006-02-15
Posts: 2169
I've been thanked 90 times.
Offline
Not sure why all the javascript.
All you really need to have on the page where you want the images displayed;
Code: html
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="480" height="360" id="BasketIntro" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="BasketIntro.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="BasketIntro.swf" quality="high" bgcolor="#ffffff" width="480" height="360" name="BasketIntro" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
This can be cut down to even less, take a look at the flash I have on my security site (in signature)
Here is the code I use,
Code: html
<object title="photos of eagles in flight" type="application/x-shockwave-flash" data="inside.swf">
<param name="movie" value="inside.swf" />
<noscript><p><img class="liner" alt="photos of eagles in flight" src="inside1.jpg" height="91" width="300" /></p></noscript></object>
Attention designers and webmasters - "The Beauty of CSS"
Valid Web Designs tutorials on HTML, XHTML and CSS
Home Security Systems
Member
From: South Africa, Port Elizabeth
Registered: 2006-08-23
Posts: 1795
I've been thanked 33 times.
Offline
Im gonna jump on a limb here but im guessing the swf has a stop command in the action script, if you remove that the swf will loop continuously like a gif animation. That would probably save you stacks of coding and figuring out time. Imbedding flash in html is easy and doesnt normally play a role in setting an swf to loop... at least not as far as i have seen. If oyu copy and pasted the actionscript into your swf or you made it from a template it will probably have the stop () ; line in there somewhere.
My up and coming... soon to be real website... www.thewebguy.co.za (one day i will finish it
)Member
From: Nashville TN
Registered: 2007-08-30
Posts: 82
I've been thanked 1 times.
Offline
Hi y'all,
Yeah...I wasn't too sure of all the java script either. I know some of it has to so with checking to see if the person's computer has the proper flash player installed on it. If it doesn't, the script is supposed to automatically try to download the Flash player. (at least I think that' what I understood when I read about it). I think most of the important script that checks this is in the external .js file <script src="AC_RunActiveContent.js" language="javascript"></script>. I ended up only including the HTML between the <object> tags and it worked fine. I'm just not sure if the software auto-load feature will work correctly now or not.
The .jpg's loop OK. No problem there. The loop feature was a setting that was set before I published the .swf.
I went back and looked at the picnictime site and it looks like they were able to get all their .jpg's to loop by just using a function that's defined in the <head> section and then called in the opening <body onload=ImagePreload().............................> Real cool but I'm afaid it's too deep for me at the moment. I'll have to stick to embedding the <object> for now.
Moderator
From: Deland, FL
Registered: 2005-10-25
Posts: 1271
I've been thanked 20 times.
Offline
Flash is cool and all, but if you are looking for an alternative, a little JS would work (of course, you lose the effects in the example I'm going to show).
But, if you read up on Flash and how to show alternative content when the user doesn't have flash, this should work well.
Code: Javascript
function rotateImages() {
setTimeout(document.getElementById("rotating_images").src="img2.gif", 1000);
setTimeout(document.getElementById("rotating_images").src="img3.gif", 2000);
}
The "1000", "2000" is milliseconds. That is the delay between switching the images. You can add as many as you want to!
Then, the HTML
Code: HTML
<body onload="rotateImages();">
<img src="img1.gif" id="rotating_images" alt="Whatever Alt Text" />
I'm pretty sure that will work. I'm still learning JS so there might be something slightly wrong with that, but if there is either myself or someone here can help get it working if you decide to go this route.
Member
From: Nashville TN
Registered: 2007-08-30
Posts: 82
I've been thanked 1 times.
Offline
Wow...Mark. Cool idea. I"ll have to play around with that one. If the JS is used like you show it, it would keep the clutter out of the <body> of the HTML. One could even store the JS function in an external JS file to keep the clutter out of the <head> section as well.
Moderator
From: Deland, FL
Registered: 2005-10-25
Posts: 1271
I've been thanked 20 times.
Offline
GP Michal wrote:
Wow...Mark. Cool idea. I"ll have to play around with that one. If the JS is used like you show it, it would keep the clutter out of the <body> of the HTML. One could even store the JS function in an external JS file to keep the clutter out of the <head> section as well.
Correct 
Let me know if you want to go the JS route and I'll be more than happy to help you get it working!
we used the same code as suggested by cool eagle and it works fine however we ran into one big drawback and that is the noscript tag has a history of being used by spammers as a way of stuffing unrelated links and content on a page. (The fact that the NOSCRIPT content is not seen by most users would make it a way to hide content.)
The result is that the search engines cannot really trust the content found within a NOSCRIPT tag and many (google seems to swith on and off on this issue) will not index any content within the NOSCRIPT tags.
The page we had with the noscript tag was supplemented by google. We removed the noscript tag and within a week that page was fully indexed again.
| Never |


