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
I use this: <object data="flash.swf" type="application/x-shockwave-flash" width="xxx" height="xxx" ><param name="movie" value="flash.swf" /></object> Code (markup): Seems to work with most browsers, and validates as XHTML 1.0 Strict.
Hi Kerosene, your code is not the best one. You must use the object tag but the embed tag too (to work with all browsers). This is the minimum code you need to embed a Flash movie in a browser : <object width="500" height="500"> <param name="movie" value="flash.swf"> <embed src="flash.swf" width="500" height="500"> </embed> </object> Code (markup):
W3schools.com is NOT W3C, and they don't mention that <embed> IS valid - because it's not. Run your <embed> code through the W3C validator. <embed> is not part of the XHTML specification and will not validate.
I know W3schools.com is NOT W3C, sorry for that. But I think a website is for visitators not for search engines or to be W3C valid. If a website is not W3C valid but works in all browsers is ok.But if is valid and not works in Netscape or another browser isn't ok.
This thread is about validation, not usability: I generally don't bother to validate my own sites that use Flash, but sometimes it's a legal requirement to do so - some universities and government departments legally require their sites to be 100% W3C valid. Valid is valid. And no matter what you do, <embed> will never be part of the XHTML standards.