Click to See Complete Forum and Search --> : The correct way... valid code
oo7ml
02-16-2009, 04:54 AM
What is the best (most valid) way to embed a flash file.
Say we have a file called flash.swf which is 500 x 500. What is the correct code to use to insert this flash file into a page.
Thanks in advance
coothead
02-16-2009, 05:34 AM
Hi there oo7ml,
well, I would do it like this...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<style type="text/css">
#myflash {
width:500px;
height:500px;
display:block;
margin:auto;
}
</style>
</head>
<body>
<div>
<object id="myflash"type="application/x-shockwave-flash" data="flash.swf">
<param name="movie" value="flash.swf">
</object>
</div>
</body>
</html>
Further reading:-
The Satay Method (http://www.alistapart.com/articles/flashsatay)
Bye Bye Embed (http://www.alistapart.com/articles/byebyeembed/)
coothead
Charles
02-16-2009, 06:13 AM
But don't forget http://www.w3.org/TR/WCAG10/#gl-provide-equivalents .<object id="myflash"type="application/x-shockwave-flash" data="flash.swf">
<param name="movie" value="flash.swf">
<a href="alt-content.html">Link Text</a>
</object>If you don't just include the alt-content itself inside the OBJECT element.
etard
05-07-2009, 11:26 AM
not working for me in IE 7 since it does not stream flash content to IE browsers. meaning, it waits for the entire movie to cache locally before showing a single frame. :( no good
I used this and it W3C validated
<object data="path_to_file/file.swf" type="application/x-shockwave-flash" width="insert_width_of_movie" height="insert_height_of_movie">
<param name="movie" value="path_to_file/file.swf">
</object>
and worked on Mac/PC - safari, IE, FF, Opera, Chrome, NS,
felgall
05-07-2009, 05:10 PM
not working for me in IE 7 since it does not stream flash content to IE browsers
That is because of the way the browser is designed. There are only two options to resolve that - one is for your visitors to switch to a better browser (which isn't likely to happen) or you could switch to using a streaming format that is handled by the server rather than depending on support from the browser.
Eye for Video
05-07-2009, 07:44 PM
With all due respect etard and felgall, what makes you think that the browser (like IE) has anything to do with whether Flash files must be fully downloaded before they begin to play.
To clarify
in IE 7 since it does not stream flash content to IE browsers. meaning, it waits for the entire movie to cache locally before showing a single frame
I think what etard meant to describe was progressive downloading (not streaming), or downloading a small part of the file into a buffer and after the buffer time elapses, begins playing the file concurrently with downloading the rest of the file … hence, progressive downloading. True steaming does not cache the file locally, so that was not the downloading method discussed.
The web server is responsible for supporting progressive downloading of particular file types or not supporting it. It has nothing to do with the browser (IE has enough problems without heaping this one on it too).
If your Web server supports progressive downloading of Flash files… regardless of browser, they will progressive download. Here is a 8MB Flash .swf which will progressively download:
http://www.cidigitalmedia.com/web_devel/flash_test/flash_test.html
This is not a Flash .swf player which loads a .flv file but 1 great big .swf.
Test this theory by clicking on the link and as soon as the Flash starts, disconnect from the Internet by putting your cable modem on standby (or just watch a download monitor like the AVG icon).
Whatever was downloaded will play, but the entire Flash will not, since the entire file was not downloaded….only the buffer played….shows progressive downloading.
If your Flash files do not progressive download it is the fault of the server, not the browser. If your server DOES support progressive downloading but some of your (so called Flash files) do not, it’s probably because they were created using Flash knock-offs like Swish-Max, converted to Flash by non-Flash converters, or even QuickTime movies being played in Flash. Rarely do you see servers supporting progressive downloading of QT.
Oh… back to the first point of this thread… you might also consider using swfobject.
http://code.google.com/p/swfobject/
and lots more about it out there, just Google it.
Best wishes,
Eye for Video
www.cidigitalmedia.com