Jump to content
xisto Community
iGuest

Help Me Flash My Website.

Recommended Posts

I have a website and have inserted flash. However when I preview it on my site it will not start automatically I have to left click to play. When I preview it on my Decompiler premium it works just fine, can some one please help me, I'm so confused! what am I doing wrong? 

question by Jules

Share this post


Link to post
Share on other sites

<p>I have a website and have inserted flash. However when I preview it on my site it will not start automatically I have to left click to play. When I preview it on my Decompiler premium it works just fine, can some one please help me, I'm so confused! what am I doing wrong? </p>question by Jules

You have to set focus to the flash when window loads, you can use on load event of window to to do it, as followswrite your body tag as follows
<body onload='setFocus()'>//html content</body>
and in javascript write function
function setFocus(){document.getElementById('myFlashId').focus();}
replace 'myFlashId' with your id.

Share this post


Link to post
Share on other sites

Yeah this is a pretty crappy "feature" on Internet Explorer's part. To my knowledge, there is no other browser that purposely disables flash until the user decides to have it play. Every version of IE seems to be a step back....

Share this post


Link to post
Share on other sites

Setting the focus to the Flash and leaving it there is not necessarily a good idea. If you do that, you can throw off people who are trying to navigate with the keyboard (for example, I usually scroll pages with the keyboard, and use plenty of keyboard shortcuts in my browsers). If the focus is left on the Flash object then all keystrokes go to Flash rather than the browser, so your website seems broken and unresponsive until you click randomly on an empty spot on the page to remove the focus.And that feature does have its uses. When I'm forced to use IE, and therefore see thousands of unwanted Flash ads, its nice that they don't start playing unless I want them to. If the advertisers won't follow the rules (that the ads must all be click-to-play) then it looks like Microsoft will force them.

Share this post


Link to post
Share on other sites

Be sure to check it on Mozilla Firefox.I believe this browser is easier for IT departments to restrict certain rated sites. Hence companys will soon switch to this browser.Although this is what one of the lads in our IT dept says, so not sure how true it is...

Share this post


Link to post
Share on other sites

i think you can make auto start after 2 or 3 seconds the website loaded , in fact one second is the best, or 0 seconds...no matter, your choice. Oh i think this is a common problem check if you don't have some other software installed that blocks your flash program from executing, check for latest version, you can make uninstall - install again, if that doesn't work try using flashobject. Please come back and tell what happened.

Edited by SofiaComp (see edit history)

Share this post


Link to post
Share on other sites

I would wait about half a second or a second before the site loads, I believe you just add another line of the code to the set focus. I know that sometimes it is the browser's fault, like as they say MSIE does that, but I think that may not be true, your decompiler goes to the site as its set, but not the way the browser loads the page, so that may be the problem. IE does not stop Flash Ads though whoever said that is wrong, those Ads bypass it and work anyway.

Share this post


Link to post
Share on other sites

You could try embedding the flash using swfobject. �Some browsers make you click once on the flash before you can give it focus. �swfobject lets you bypasses the "click to activate control" thing, so if your flash isn't automatically playing because that, swfobject could help. �Also, swfobject tries to embed flash properly across all browsers, so it might solve your issue even if the problem is something else entirely. You can download the swfobject javascript at https://code.google.com/archive/p/swfobject or simply link to google's version� which can be found here. Detailed info on how to use swfobject can be found at https://code.google.com/archive/p/swfobjectwiki/documentation/, but you'll want to use the dynamic method. �swfobject will use javascript to replace the contents of a <div> tag with a flash file. The general code to dynamically embed a flash file using swfobject looks something like 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/; lang="en" xml:lang="en">� <head>� � �<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> � � �<script type="text/javascript">� � � � var flashvars = {};� � � � //You can embed the flash with parameters. �The following...� � � � flashvars.var1 = "one";� � � � flashvars.var2 = "two";� � � � //... is equivalent to: the-flash-file.swf?var1=one&var2=two� � � � var params = {};� � � � var attributes = {};� � �swfobject.embedSWF("the-flash-file.swf", "the-div-to-replace", /*width*/ "300px", /*height*/ "120px", /*minimum flash version*/ "9.0.0", null, flashvars, params, attributes);� � �</script> </head> <body>� <div id="the-div-to-replace">� � �<!-- Alternate content for if javascript is off or flash version is too low goes here -->� � � �<!-- These comments will be replaced when swfobject embeds the flash -->� � � �<!-- If it fails, this content will be left alone -->� </div> </body></html>

swfobject won't steal the focus either, so it's probably worth a shot to see if it works.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.