This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-30 15:07:33

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Running Scratch.swf in IE

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

 

#2 2012-10-30 15:14:41

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: Running Scratch.swf in IE

What's Scratch.swf? Is it an old flash version of scratch or somthing??

Last edited by DigiTechs (2012-10-30 15:14:56)


I'm back.
Maybe.

Offline

 

#3 2012-10-30 16:12:22

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Running Scratch.swf in IE

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:

Code:

<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:

Code:

<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:

Code:

setPlayerSize(482, 387);

to read:

Code:

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)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#4 2012-10-30 17:11:14

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: Running Scratch.swf in IE

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

 

Board footer