PDA

View Full Version : Step by Step instructions to use SWFObject


Unknownflavour1
02-15-2008, 06:15 PM
Hello All,

I was referred to this site (http://blog.deconcept.com/swfobject/) in order to solve and issue I had with SWF files having a border when importing it into Dreamweaver. I'm new to this and I don't understand the directions to very well.

Can anyone guide me through this step by step? To get a better understanding, I have created a dummy SWF file from Flash (media.html) and imported it into Dreameaver. Here's how the code looks.


<!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=ISO-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="420">
<param name="movie" value="media.swf" />
<param name="quality" value="high" />
<embed src="media.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="420"></embed>
</object>
</body>
</html>

Please explain!! Your help is VERY APPRECIATED.

Please explain the .js file too.

Thanks.

ASWC
02-15-2008, 06:32 PM
Your HTML code has no border defined for you content. I suggest you save it and test it on a browser since that's really where it's gonna show. Dreamweaver cannot show you exactly how it's gonna look so always test on a browser.
There's no javascript showing in this html. The SWFObject javascript is used to embed Flash content dynamically at load time and has many application, one of them is to avoid having to click once to access the swf in browser like IE7 or Opera9.
When you download the SWFObject files, it ships along a simple and efficient documentation of how to use it. I suggest you try that first.

Scuba_Steve
02-15-2008, 06:51 PM
yeah i know it's not exactly what you were hoping for, but the best documentation for how to implement swfobject is the included documentation. i believe the website also provides word for word explanations of code for 3 different ways to use SWFObject.

atomic
02-15-2008, 08:29 PM
1. Forget about DW. We won't be using it.

2. Go to http://blog.deconcept.com/swfobject/

3. In the table of contents, hit download.

4. Download the Download SWFObject 1.5 zip file.

5. Decompress the zip package.

6. Within the zip package, inside the swfobject1-5 folder, you'll find the file swfobject. That's the javascript file you'll need to upload to your server in the same directory/folder as your media.swf.

7. Open some text editor...

8. Copy & paste the following...



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EMBEDDING A FLASH MOVIE WITH THE SWFOBJECT </title>
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>
<div id="flashcontent">
This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
var so = new SWFObject("media.swf", "mymovie", "780", "420", "7", "#FFFFFF");
so.write("flashcontent");
</script>
</body>
</html>



9. Save the above text file as media.html

10. Upload to your server, and in the same directory/folder, the above saved media.html, your media.swf, and the swfobject.js file, I told you to identify in the downloaded zip package..

11. Open a browser, and in the address bar, type...

http://www.yourDomain.com/media.html

Of course, replace the yourDomain.com, with the actual name of your domain and/or server, or free host...

12. What do you get?

Scuba_Steve
02-15-2008, 08:43 PM
13. ????

14. Profit!

as much as i tried to fight the urge... :/

ASWC
02-15-2008, 08:47 PM
I knew he didn't like the movieClipLoader class but now he doesn't like Dreamweaver! Where is he gonna stop!

atomic
02-15-2008, 08:54 PM
When I've decompiled and stolen all of your marvelous code! :p

But I have yet to see some of your work that would be worth decompiling!

Scuba_Steve
02-15-2008, 08:56 PM
... and we've come full circle. :)

asf8
02-15-2008, 08:59 PM
When I've decompiled and stolen all of your marvelous code! But I have yet to see some of your work that would be worth decompiling!

... and we've come full circle. :)

:o LOL

PS: good step by step atomic as Unknownflavour1 requested.

ASWC
02-15-2008, 09:09 PM
I can't help it Atomic, you're my favorite!

atomic
02-15-2008, 09:36 PM
I can't help it Atomic, you're my favorite!

Yeah! I've heard that one before!

Flattery will lead you nowhere!

ASWC
02-15-2008, 09:48 PM
Gosh you are so smart! You even knew I was kidding... amazing! :rolleyes:

CyanBlue
02-16-2008, 08:09 PM
Moving to the HTML and JavaScript forum...