PDA

View Full Version : Flash Integration



llorax
04-18-2007, 06:14 PM
Can anyone help me find tutorials/help pages on how to use javascript to swap out content with flash. I'm trying to integrate a website using that and can't find anything I'm looking for!

riptide
04-18-2007, 07:09 PM
you can do this without javascript I think. why do you need it.

llorax
04-19-2007, 04:02 AM
I made a navigation in flash but the website itself I am not coding in flash so I was told that I can use javascript to swap content in the div for the flash navigation.

nwalton
04-19-2007, 07:23 AM
There are other alternatives, but the standard that I've seen used most is swfObject. Very stable. Search-engine friendly. Easy to use. It allows you to put in alternate content that gets swapped out if Flash is available.

http://blog.deconcept.com/swfobject/

llorax
04-19-2007, 05:57 PM
What is the best way to do that then? Is javascript not recommended?

mburt
04-19-2007, 06:50 PM
Personally, I would prefer JavaScript over Flash, because with Flash for people without Adobe Flash Player (or equivalent) they can't navigate through your site.
DD has a couple Content Switch scripts, here's one of them:
http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

nwalton
04-19-2007, 08:11 PM
I made a navigation in flash but the website itself I am not coding in flash so I was told that I can use javascript to swap content in the div for the flash navigation.

Again, the best way I know to do this is to use the javascript found at
http://blog.deconcept.com/swfobject/

First, put the swfobject.js script on your server.
In the head of your HTML page, link the script to your document like this:


<script type="text/javascript" src="swfobject.js"></script>

Make a <div> that will hold your flash menu. This can be an empty <div> or it can have content (perhaps an HTML version of your menu):


<div id="flashcontent">
This text is replaced by the Flash movie.
</div>

After that <div>, add the javascript function call:


<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#FFFFFF");
so.write("flashcontent");
</script>

The parameter "movie.swf" should be the path to your swf movie. "mymovie" is the id that will be assigned to the object or embed tag. the next two are the width and height, followed by the Flash version that should be detected, and finally the background color. There is a lot more info about it on the link above.

This code will insert your flash movie into your HTML file if the required Flash version is present. If not, people will just see whatever HTML you had in the <div> to start with.

mburt
04-19-2007, 08:15 PM
Whoa... never seen anything like that before. That's a pretty snazzy script. I don't particularly like all the browser detection though, but I guess that's necessary in some cases.

boxxertrumps
04-19-2007, 08:18 PM
But what about the people with JS turned off...

they cant veiw the movie, assume it isn't there and move onto another site.
To be safe, have noscript tags in the div with the movie.

nwalton
04-19-2007, 11:30 PM
But what about the people with JS turned off...

If people have js turned off, they just see the alternate content provided in the <div> (if any). If it were a menu like this one, I'd just provide an HTML menu there. In a lot of cases, people who don't have Flash or have JS turned off won't even know that the Flash was supposed to be there.

Plus, search engines see your alternate HTML content even though most users see the Flash.