I have a swf file in an html page. The dimensions of the swf load correctly when I view it in eclipse's web browser, but when I put the file in internet explorer (10?) the outer perimeter of the window is cropped, so that only part of the swf video is visible while it is playing. I want users in a wide variety of browsers to be able to load the video without problems. How can I accomplish this in code?
Here is the code which is causing the problem:
<div style="float:right;display:inline-table;">
<OBJECT classid="clsid:bunchalettersandnumbers" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,28;" WIDTH=616 HEIGHT=490>
<PARAM NAME=movie VALUE="my_vid.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE="#FFFFFF">
<param name="allowFullScreen" value="true" >
<EMBED src="my_vid.swf" allowfullscreen="true" quality=high bgcolor="#FFFFFF" WIDTH=616 HEIGHT=490 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>
</div>
EDIT:
As per Aspiro's suggestion, I am using the following code now, but it is still causing the same problem:
<head>
<script type="text/javascript">
swfobject.embedSWF("myvid.swf", "myContent", "700", "550", "9.0.0");
</script>
</head>
<body>
<div id="myContent" style="border: 3px solid #FFCC66;">Some text</div>
</body>
You're not declaring an object type, or wrapping your width and height attributes in quotes.
Check your code against the official manual SWF embed syntax. Here's an example on Adobe's site: http://helpx.adobe.com/flash/kb/object-tag-syntax-flash-professional.html
Related
Our current implementation for YouTube videos use standard <object> from API documentation and is no longer loading correctly.
It shows an empty Object with link to YouTube page.
Created an example using code from documentation and error is reproduce-able.
Anybody know if there's another way to use the embedded code from YouTube?
Example code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<object width="640" height="390">
<param name="movie"
value="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="https://www.youtube.com/v/M7lc1UVf-VE?version=3&autoplay=1"
type="application/x-shockwave-flash"
allowscriptaccess="always"
width="640" height="390"></embed>
</object>
</body>
</html>
API Documentation: https://developers.google.com/youtube/player_parameters
You don't need all those thing just do it like this..
<object width="420" height="315"
data="http://www.youtube.com/v/XGSy3_Czz8k">
</object>
OR
<embed width="420" height="315"
src="http://www.youtube.com/embed/XGSy3_Czz8k">
Most YouTube videos are been embedded in an iframe tag like this:
<iframe src="link_to_video"></iframe>
Use iframe youtube embedded option.
Or you can do it your self on you tube click on share under you tube video and click on embed.Copy and paste code in your html.
Share 2. Embed 3. Copy & Paste
The problem can also be solved, if the video is called over the API url.
https://www.youtube.com/apiplayer?version=3&video_id=oPEJzOTgQCE&enablejsapi=1&playerapiid=ytplayer&rel=0
This can use all the extra parameters and works the exact same way as the other URL.
<object data="https://www.youtube.com/apiplayer?version=3&video_id=oPEJzOTgQCE&enablejsapi=1&playerapiid=ytplayer&rel=0" type="application/x-shockwave-flash" id="flash_236856494" width="312" height="173"><param name="scale" value="showAll"><param name="salign" value="tl"><param name="menu" value="false"><param name="update" value="true"><param name="allowfullscreen" value="true"><param name="wmode" value="opaque"><param name="bgcolor" value="#DADADA"><param name="allowScriptAccess" value="sameDomain"><param name="flashvars" value="youtubeId=oPEJzOTgQCE&autostart=false&suggestedQuality=large"><param name="movie" value="https://www.youtube.com/apiplayer?version=3&video_id=oPEJzOTgQCE&enablejsapi=1&playerapiid=ytplayer&rel=0"></object>
I am using this code to link an embedded .swf file to another page inside an iframe :
<div onmousedown="window.location.href='http://www.pagewhichopens.com'" height=26 width=100>
<object height=26 width=100>
<param name="movie" value="http://www.bcd.com/embeddedfile.swf">
<param name="wmode" value="transparent" />
<embed wmode=transparent allowfullscreen="true" allowscriptaccess="always" src="http://www.bcd.com/embeddedfile.swf" height=26 width=100></embed>
</object>
</div>
But when I cick on the swf the another page opens inside that iframe only which I don't want, I want it to open in the whole browser... which can be done by inserting target="_parent", but where should I put it?
Use top.location to set the location of the top frame or parent.location for the immediate parent. window refers to the current context (inside the frame).
To open some link in a new tab use target="_blank" to achieve this
I have the following code to display the swf object on the page. It works well in all browsers. However, if shockwave flash turned off in Firefox, it won't fallback into image and show bunch of characters instead looking like "CWS q�x��wX�Y�7z�..." All other browsers fallback to the image. I verified that we serve application/x-shockwave-flash MIME type on our server.
<script type="text/javascript">
swfobject.registerObject("fd_flash","8.0.0");
</script>
<div>
<object height="376" id="fd_flash" width="940">
<param name="movie" value="path/file.swf" />
<param name="wmode" value="opaque" />
<!--[if !IE]>-->
<object data="path/file.swf" height="376" type="application/x-shockwave-flash" width="940">
<!--<![endif]-->
<div><img src="path/image.jpg" /></div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
Thank you!
You could try another way of using swfobject. Add a link in your <head> to your swfobject.js file, then in your <body> put this:
<div id="yourFlashDiv">
<!-- ALTERNATE CONTENT GOES HERE -->
<p>This paragraph will show if your Flash content won't</p>
<!-- FLASH CONTENT GOES HERE -->
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("path/file.swf", "SwfTitleGoesHere", "376", "940", "8", "#FFFFFF");
so.addParam("wmode", "opaque");
so.write("yourFlashDiv");
// ]]>
</script>
</div>
This is what I've used for swf display, and it has failed gracefully on every browser I've tested. Hope this helps
<object height="25" width="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" name="movie"/>
<param value="high" name="quality"/>
<param value="#FFFFFF" name="bgcolor"/>
<param value="opaque" name="wmode"/>
<embed height="25" width="75" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#FFFFFF" quality="high" src="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK"/>
</object>
I am having to insert this legacy markup into a new site that I'm building. Problem is its using an <embed> tag.
Would I just do away with the <embed> and put some content in as an alternative, for those that do not have flash? Basically I'm just trying to bring this piece of html into the 21st century.
You can nest object elements to display alternatives. The W3C explains it here. I copied a snippet below:
One significant consequence of the OBJECT element's design is that it offers a mechanism for specifying alternate object renderings; each embedded OBJECT declaration may specify alternate content types. If a user agent cannot render the outermost OBJECT, it tries to render the contents, which may be another OBJECT element, etc.
In the following example, we embed several OBJECT declarations to illustrate how alternate renderings work. A user agent will attempt to render the first OBJECT element it can, in the following order: (1) an Earth applet written in the Python language, (2) an MPEG animation of the Earth, (3) a GIF image of the Earth, (4) alternate text.
<P> <!-- First, try the Python applet -->
<OBJECT title="The Earth as seen from space"
classid="http://www.observer.mars/TheEarth.py">
<!-- Else, try the MPEG video -->
<OBJECT data="TheEarth.mpeg" type="application/mpeg">
<!-- Else, try the GIF image -->
<OBJECT data="TheEarth.gif" type="image/gif">
<!-- Else render the text -->
The <STRONG>Earth</STRONG> as seen from space.
</OBJECT>
</OBJECT>
</OBJECT>
I recommend that you use swfobject which is a cross platform, open source library to display flash on your pages.
http://code.google.com/p/swfobject/
There are a variety of ways to load the flash and the alternative (non-flash) content. For example the following code could replace your code:
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK",
"myContent", "25", "75", "9.0.0");
</script>
<div id="myContent">
<p>Alternative content</p>
</div>
Basically, you should keep embed, because it is a fallback for some old browsers. It might hurt validation of page, but as long as you know why it is there, it is OK.
At least that's the way Adobe officially recommends: Macromedia Flash OBJECT and EMBED tag syntax
You are right to want to do code for XXIth century, but we have to deal with browser from previous millennium... :-)
I use function AC_FL_RunContent for embedding flash objects - it's good because it supports all browsers and is recommended by Adobe.
More is here:
They also suggest using <object> tag instead of <embed>
I found this code on the web (from a usability site) which caters for IE and others, and I use it on my flash pages (I've changed it to your code):
<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" width="75" height="25">
<!-- <![endif]-->
<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="75" height="25">
<param name="movie" value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" />
<!--><!--dgx-->
<param name="loop" value="false">
<param name="menu" value="false">
<param name="quality" value="high">
</object>
<!-- <![endif]-->
Are there any ways providing an alternate GIF/PNG image, in case the user has no Adobe Flash installed and/or deactivated.
I’ve found recommendations, like the following from W3C, which determine via JavaScript the existence of Adobe Flash on the client: W3C Providing alternative images
Honestly, I would prefer a non JS technique. I’m thinking of some XHTML tag, equivalent to <noscript>. (like <noobject> if the object (in our case Flash) can’t be displayed/loaded).
The reason for needing this separation is the following:
The bank I’m working for will preferably display their banners in Flash format. In case it isn’t possible a simple image should be shown.
In the past it was solved very likely in the way mentioned before. We’re currently working on a design refresh and that’s where I stumbled upon this piece of code which makes me wonder if it’s really the most elegant and compatible way of doing so.
Another idea that strikes me: Is it actually possible to load Flash-objects in a JavaScript disabled environment?
Actually having flash installed but javascript turned off is a valid scenario. This should work across most browsers:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="flashContent">
<param name="movie" value="flash.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="flash.swf" width="800" height="600">
<!--<![endif]-->
<img src="(...)" alt="Put your alternate content here" />
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
I use the following code for graceful degradation. It works well.
<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="flash.swf" width="500" height="100">
<!-- <![endif]-->
<!--[if IE]>
<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="500" height="100">
<param name="movie" value="flash.swf" />
<!--><!--dgx-->
<param name="loop" value="false">
<param name="menu" value="false">
<param name="quality" value="high">
<img src="flash_replacement.png" width="500" height="100" alt="No Flash">
</object>
<!-- <![endif]-->
I don't know why you want to avoid javascript, it is the best solution when dealing with Flash.
using the SWFObjects Library (the best known so far for the matter) you can do this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> My Home Page </title>
<meta name="viewport" content="width=780">
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>
<div id="splashintro">
<img src="splash_noflash.png" />
</div>
<script type="text/javascript">
var so = new SWFObject("csplash.swf", "my_intro", "300", "240", "8", "#338899");
so.write("splashintro");
</script>
</body>
</html>
what the script does is replace the splashintro div with the flash file, if the browser does not support Flash, then does nothing and the splash_noflash.png will be shown.
P.S. With this technique you are ready for the iPhone, instead of showing the blue cube, it will show the image :)
I find using inline styling to do the trick.
For example:
<div style="background-image: url('...');">
<object>
/* Embedded Flash */
</object>
</div>
We can provide an alternate GIF/PNG image, in case the user has no Adobe Flash installed and/or deactivated.
<object id="flashcontent classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550px" height="400px">
<param name="movie" value="mymovie.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="mymovie.swf" width="550px" height="400px">
<!--<![endif]-->
<p>
Fallback or 'alternate' content goes here.
This content will only be visible if the SWF fails to load.
</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
And also add this...
<script type="text/javascript">
swfobject.registerObject("flashcontent", "9", "/path/to/expressinstall.swf");
</script>
I have written an easy way to do this in CSS - no extra JavaScript at all.
Name your ID/Class where your Flash movie resides and use a background image. Wrap your Flash movie within that div.
For example:
<div ID="MyFlashMovie"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="flashContent">
<param name="movie" value="flashMovie.swf" />... etc., etc.</object>
</div> etc.
Then in your CSS:
#MyFlashMovie {
background: url("alternateGraphic.png");
background-repeat: no-repeat;
height: XXpx;
width: XXpx;
}
When the Flash isn't available, say on the iphone/pad, the graphic will display. The only drawback with this, that I have found, is that if your Flash movie uses a transparent background, you will see the alt graphic through the transitions. Just make a solid color within the Flash movie as your lowest layer (make sure it's the same bg color as the website) and it will look fine.
~GreaseJunkie