Has someone succeeded in running Scratch.swf in IE from a personal website? I was able to do it in FireFox and Chrome, but I couldn't get the same result in IE.
Offline
I'm doing it on my own web page and you can see it here: http://www.boltbait.com/free/games/chess/
OK, first you need to put this code in the <head> section of your page:
<script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var flashapp; function installPlayer(swfName, swfID) { var flashvars = { project: 'ChessV23.sb?version=1'}; var params = {}; var attributes = {}; swfobject.embedSWF(swfName, swfID, 482, 387, '10.0', false, flashvars, params, attributes); flashapp = document.getElementById(swfID); flashapp.style.position = 'relative'; flashapp.parentNode.parentNode.style.overflow = 'visible'; // override CSS flashapp.style.zIndex = 1000; // put in front setPlayerSize(482, 387); } function setPlayerSize(w, h) { var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") > 0; if (isFirefox) w += 1; if (navigator.appName == 'Microsoft Internet Explorer') { flashapp.style.width = w; flashapp.style.height = h; } else { flashapp.width = w; flashapp.height = h; } } </script>
Be sure to replace ChessV23.sb with the name of your project file. There is NO need to change the version number.
Then, you need to put this portion in your <body> section:
<div class="border" style="width:483px; height:387px"> <div id="PlayerOnly"> <p>Flash Player Required</p> </div> <script type="text/javascript"> <!-- installPlayer('PlayerOnly.swf', 'PlayerOnly'); //--> </script> </div>
You'll need to have the following files in the same directory on your web server:
swfobject.js
PlayerOnly.swf
ChessV23.sb
You'll have to grab those files off of the Scratch web site. Of course, change ChessV23.sb to your project file.
If you're using the new style player, change the following line:
setPlayerSize(482, 387);
to read:
setPlayerSize(482, 401);
and change the div line to match.
Now, this is more complicated than the stuff you'll find on the other threads here on the messageboard. But, that code won't work in IE. The only problem I've had so far is that I can't get the full screen button to work. I'm open to suggestions of how to get that to work on IE.
Last edited by BoltBait (2012-10-30 16:15:14)
Offline
BoltBait wrote:
I'm doing it on my own web page
It works!!!! I just get a yellow warning sign ("error visualizing the page" at http://www.sitibs.com/files/stefano/scr … %20new.htm) when I load the page in IE but... it works :-)
Thanks a lot.
Offline