Well, I must say this is embarrassing to ask, but to my defense I'll say that throughout my years of web development I've never encountered a case where embedding flash was absolutely necessary.
The Question
Simple, how do I embed a flash object of any kind (*.swf or if there any other options, them too) to my website?
Some Points
I don't need the code, I already have that, I just don't really understand it.
I'm looking for a good explanation on how to use the <embed> or <object> elements.
I've been searching around but couldn't find a clear explanation, even in the specs.
I'd award any good answer with an upvote, a cookie, and an accepted answer to the best :)
Definitions:
http://www.w3.org/wiki/HTML/Elements/embed
http://www.w3.org/wiki/HTML/Elements/object
Explanation on how to embed a flash object from Adobe:
http://kb2.adobe.com/cps/415/tn_4150.html
"The HTML OBJECT tag directs the browser to load Adobe Flash Player and then use it to play your SWF file."
Change "YOURFILENAMEHERE.swf" with your .swf file name.
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="Yourfilename" ALIGN="">
<PARAM NAME=movie VALUE="YOURFILENAMEHERE.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#333399>
<EMBED src="Yourfilename.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="Yourfilename" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
Related
Gofundme gave me the following widget code to add to my webpage, however it doesn't appear on my page. I think that it might have something to do with the embed tag as my design software states that "In HTML 4.01 Transitional the tag is not permitted." Could that be the problem?
Here's the code they sent me:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="258" height="338" title="Click Here to donate!" type="application/x-shockwave-flash"><param name="movie" value="/Widgetflex.swf"><param name="quality" value="high"><param name="flashvars" value="page=drum-lessons-for-indigent-students&template=6"><param name="wmode" value="transparent"><embed allowScriptAccess="always" src="/Widgetflex.swf" quality="high" flashVars="page=drum-lessons-for-indigent-students&template=6" type="application/x-shockwave-flash" wmode="transparent" width="258" height="338"></embed></object>
Kokesh is right, there are some issues with flash in some instances but the real issue with the gofundme widget has to do with how it's written for you to copy and paste. It's looking for a local file.
This tutorial should help with getting it to work using a workaround.
http://manicpixieropedoll.blogspot.com/p/gofundme-n.html
It is a Flash object. Flash is on it's way out and already blocked in Chrome. Do they provide some more civilized solution? I actually found your question as this happened just now to my wife.. I will look for solutions, but unless GoFundMe provides other widget, I'm not sure what to do.
i just want to embed a flash like this:
<object
data="data:application/x-shockwave-flash;base64,..."
type="application/x-shockwave-flash">
<param name="movie"
value="data:application/x-shockwave-flash;base64,..."
/> </object>
but it just doesn't work. Did i make any mistake?
thankz
That's because it doesn't work. Not only would you have a buffer overflow, but most browsers don't allow for the inclusion of Flash via Data URIs. If you need a good place to host your Flash, Google Code works just fine.
While validating my not be a big issue to some people, I personally want my page to validate whenever possible, as I feel it's a good habit to code properly whether the compiler/browser/person reading your code understands anyways.
Anyways, I'm building a website for a client that is requesting a YouTube video of theirs be embedded in the page. Easy, I grab the code from YouTube and throw it in the page. It works of course, but the page now doesn't validate under XHTML 1.0 Strict solely because of the YouTube-generated code.
The part that doesn't validate is the embed portion, and it works fine without this line in Chrome, but breaks in Firefox/IE. If it was just IE I'd just shrug it off as IE being terrible as per usual, but being as Firefox is doing it as well I'm wondering how to approach the situation. I could just dynamically input the content based on the browser, therefore validating, but that seems sloppy.
Am I fighting a losing battle and should just ignore the fact that this page doesn't validate because of this snippet?
Not actual video, just example code
<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/oHg5SJYRHA0?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/oHg5SJYRHA0?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed>
</object>
<object type="application/x-shockwave-flash"
data="http://www.youtube.com/v/oHg5SJYRHA0?fs=1&hl=en_US"
width="480" height="385">
<param name="movie"
value="http://www.youtube.com/v/oHg5SJYRHA0?fs=1&hl=en_US"/>
<param name="allowFullScreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
</object>
That should work on IE, Firefox, Opera, Safari and Chrome.
The data attribute of <object> and the movie parameter must both be present and must have the same value.
In IE this prevents the SWF from streaming and, for example, presenting a pre-loader, but that should be a non-issue for YouTube.
For more, and for a fix for that last problem, see Flash Satay: Embedding Flash While Supporting Standards.
I think if you use swfobject you could get it to validate.
http://code.google.com/p/swfobject/
The <embed> tag is new to HTML5 and it's quite possible that the validator you are using is not fully up-to-date. All of that code should be quite fine in XHTML 1.0 strict.
I'm afraid the above answers still cause validation to fail on W3C. Here's a solution which works for xhtml strict;
<object type="application/x-shockwave-flash" data="https://www.youtube.com/v/YourVideoID" width="100%" height="100%"></object>
Something like below,which is complicated to figure out what it exactly means:
9.<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="945" height="102">
10.
11. <param name="movie" value="66.swf" />
12.
13. <param name="wmode" value="transparent" />
14.
15. <EMBED height="60" pluginspage="http://www.macromedia.com/go/getflashplayer" src="66.swf" type="application/x-shockwave-flash" width="468" wmode="transparent" quality="high"></EMBED>
16.
17.</object>
Use swfobject and stop worrying about it. Let the library handle the flash embedding.
Various browsers require various embedding techniques for various reasons, and we as application developers shouldn't need to worry about the arbitrary details.
<object> isn't really old-fashoned, however using all-caps for tags like the <EMBED> you've got there is. It isn't valid XML, or valid XHTML for that matter. (Then again, doing object/embeds for flash causes validation errors with the W3C XHTML Strict validator anyway... :)
If you call things like youtube old fashioned, then yes.
Try here
In the below code, what are all the parameters and attributes used, why are all these used and what's their meaning here?
What parameters and attributes are recommended and what are not to use with a Flash tag in a HTML page?
<object id="vf_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="630" height="400">
<param name="movie" value="/videos/swf/3fun.swf" />
<param name="FlashVars" value="id=72" />
<param name="allowScriptAccess" value="always" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="window" />
<embed name="vf_flash" src="/videos/swf/3fun.swf" FlashVars="id=72" width="630" height="400" allowScriptAccess="always" loop="false" menu="false" quality="high" wmode="window" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
The Adobe website has clear and concise explanations of all of these tags, including which are optional and which are required.
http://kb2.adobe.com/cps/127/tn_12701.html
Out of order, and based on memory. Verify these all before use, but it should help you wrap your head around the concepts:
In the fight for monopoly over the web, Microsoft has committed to differ from the W3C whenever possible. Therefore, the actual tag used to embed Flash in Internet Explorer is 'object', in all real browsers it's 'embed'.
It must be noted that using '1' and '0' will give you better overall consistency than 'true' and 'false', due to this fight.
loop - tells whether or not the Flash player should attempt to restart the movie when it finishes playing it.
FlashVars - parameters can be passed into Flash, and are referred to through the flashvars unit. For example, if you create a media player that plays song1 you may pass in Flashvars="song1=song1"
movie - the URL of the Flash file. Keep it in the same folder as the HTML file calling it, or use an absolute URL or you will hit a cross-browser issue.
quality - the higher the quality the more resources Flash requires to run. While the default is good, if you are worried that the player will be used on older computers, sometimes sacrifice image quality for the sake of a less jumpy experience
wmode - the background opacity of the movie. Sometimes you want the movie to blend in with the background, and it gets set to "transparent", sometimes it should clearly be its own little box, "opaque". Note here that there are some easter eggs with this value, if you need it, there are some undocumented options for this value.
allowScriptAccess - I actually thought this was deprecated. It changed a lot in different versions. Leave this on default.
Libraries like Mootools have classes designed for working with Flash and JavaScript together.
Take a look here and here for the articles on A List Apart (ALA) on the embed vs object tags, there is a lot to be learned from it.
The one's that I can answer off the top of my head:
"movie" - the name of the flash file to load/view
"loop" - whether the animation plays once (false) or repeats (true)
"menu" - whether to show the full context menu (true) or not (false). Setting this to false shows the context menu, but it only has the "settings" and "about" options.
See Kane Wallmann's link for the full documentation.