Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Hosting Scratch 2.0 SWF on your own server.
- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
Our school district has a terrible internet connection. To have 120 students using Scratch on an unreliable WAN connection is just the worst.
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
- Download the Scratch 2.0 offline editor. (http://scratch.mit.edu/scratch2download/)
- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
Our school district has a terrible internet connection. To have 120 students using Scratch on an unreliable WAN connection is just the worst.
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
Many people are looking for a way to convert an sb2 to an swf. That's the wrong idea. scratch.swf is a complete editor AND viewer. It simply loads sb2 files via flashvars.
I've deactivated our WAN to make sure it works. scratch.swf will attempt to dial home for crossdomain.xml and language settings but those are not critical.
<script type=“text/javascript”>
var flashvars = {
project: “lightning.sb2”,
autostart: “false”
};
var params = {
bgcolor: “#FFFFFF”,
allowScriptAccess: “always”,
allowFullScreen: “true”,
wmode: ‘window’,
menu: ‘false’
};
var attributes = {};
swfobject.embedSWF(“scratch.swf”, “flashContent”, “100%”, “100%”, “10.2.0”,“expressInstall.swf”, flashvars, params, attributes);
</script>
<div id=“flashContent” width=“482px” height=“387px”>
Get <a href="http://www.adobe.com/go/getflash">Adobe Flash Player</a>, otherwise this Scratch movie will not play.
</div>
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
Many people are looking for a way to convert an sb2 to an swf. That's the wrong idea. scratch.swf is a complete editor AND viewer. It simply loads sb2 files via flashvars.
- Download the Scratch 2.0 offline editor. (http://scratch.mit.edu/scratch2download/)
- Save your project – make sure you put a sb2 extension on it. If your project is online, you can pull down the sb2 as well.
- Download scratch.swf, swfobject.js, expressInstall.swf – you'll need to host these locally.
- Edit the code below. Change lightning.sb2 to the name of your file. I'm not going to give a lesson on swfobject – there's tons of documentation on it.
I've deactivated our WAN to make sure it works. scratch.swf will attempt to dial home for crossdomain.xml and language settings but those are not critical.
<script type=“text/javascript”>
var flashvars = {
project: “lightning.sb2”,
autostart: “false”
};
var params = {
bgcolor: “#FFFFFF”,
allowScriptAccess: “always”,
allowFullScreen: “true”,
wmode: ‘window’,
menu: ‘false’
};
var attributes = {};
swfobject.embedSWF(“scratch.swf”, “flashContent”, “100%”, “100%”, “10.2.0”,“expressInstall.swf”, flashvars, params, attributes);
</script>
<div id=“flashContent” width=“482px” height=“387px”>
Get <a href="http://www.adobe.com/go/getflash">Adobe Flash Player</a>, otherwise this Scratch movie will not play.
</div>
- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
Forgot this script that needs to be above.
<script type=“text/javascript” src=“swfobject.js”></script>
Also you can download expressInstall.swf and swfobject.js from here: (https://code.google.com/p/swfobject/downloads/list)
You can download scratch.swf from here: right-click and save – ( http://cdn.scratch.mit.edu/scratchr2/static/__ff878b6c9b6c4d18fab154a707dc253c__/Scratch.swf )
<script type=“text/javascript” src=“swfobject.js”></script>
Also you can download expressInstall.swf and swfobject.js from here: (https://code.google.com/p/swfobject/downloads/list)
You can download scratch.swf from here: right-click and save – ( http://cdn.scratch.mit.edu/scratchr2/static/__ff878b6c9b6c4d18fab154a707dc253c__/Scratch.swf )
Last edited by j90009000 (June 17, 2014 17:38:00)
- DigiTechs
-
Scratcher
500+ posts
Hosting Scratch 2.0 SWF on your own server.
You could try using the offline client; the adobe AIR application.
Pretty sure you can embed it the same way using <object> tags.
Pretty sure you can embed it the same way using <object> tags.
- djdolphin
-
Scratcher
1000+ posts
Hosting Scratch 2.0 SWF on your own server.
You could try using the offline client; the adobe AIR application.
Pretty sure you can embed it the same way using <object> tags.

- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
You could try using the offline client; the adobe AIR application.
Pretty sure you can embed it the same way using <object> tags.
Yes, you can like below:
<object id=“flashplayer” style=“display: inline; visibility: visible; position: relative; z-index: 1000;” type=“application/x-shockwave-flash” data=“scratch2.swf” height=“387” width=“482”>
<param name=“allowScriptAccess” value=“sameDomain”>
<param name=“allowFullScreen” value=“true”>
<param name=“flashvars” value=“project=lightning.sb2&autostart=false”>
</object>
As djdophin indicated with his rather large dimension rage comic
, there are advantages of using swfobject over the regular object tag. However, if expect your users to disable javascript, then you have to use the object tag.- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
The only problem I have now is to make the fullscreen toggle button work. They've wired up the fullscreen button kinda wierd (as opposed to the “normal” flash way of making an app take up full screen).
- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
Ok, I figured out how the full screen button works.
- jfmateos
-
Scratcher
8 posts
Hosting Scratch 2.0 SWF on your own server.
Unfortunately this doesn´t seem to work with version v424 of scratch.swf, but it works with v367.
Which version are use using j90009000?
How this you solve the full screen issue?
Which version are use using j90009000?
How this you solve the full screen issue?
- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
Unfortunately this doesn´t seem to work with version v424 of scratch.swf, but it works with v367.
Which version are use using j90009000?
How this you solve the full screen issue?
The scratch full screen button calls a javascript function. That function “simply” sets the CSS style of most of the page elements to hide which then allows the 100% width feature of the flash applet to expand across the page.
You can trace it in firebug.
- EMPedemonte20
-
Scratcher
100+ posts
Hosting Scratch 2.0 SWF on your own server.
Our school district has a terrible internet connection. To have 120 students using Scratch on an unreliable WAN connection is just the worst.How did you use the applet tag to embed scratch 1.4
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
- Download the Scratch 2.0 offline editor. (http://scratch.mit.edu/scratch2download/)
- DigiTechs
-
Scratcher
500+ posts
Hosting Scratch 2.0 SWF on your own server.
Our school district has a terrible internet connection. To have 120 students using Scratch on an unreliable WAN connection is just the worst.How did you use the applet tag to embed scratch 1.4
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
- Download the Scratch 2.0 offline editor. (http://scratch.mit.edu/scratch2download/)
I believe you just embed the IMAGE file and tell the browser to open it up with a Squeak instance.
- TeslaTech
-
Scratcher
49 posts
Hosting Scratch 2.0 SWF on your own server.
WOW+222200+1
Last edited by TeslaTech (Sept. 27, 2014 21:13:39)
- j90009000
-
New Scratcher
40 posts
Hosting Scratch 2.0 SWF on your own server.
Our school district has a terrible internet connection. To have 120 students using Scratch on an unreliable WAN connection is just the worst.How did you use the applet tag to embed scratch 1.4
Question: How can we upload Scratch 2.0 to our local LAN webserver rather than the scratch.mit.edu server? This was easy enough with Scratch 1.4 and the applet tag.
- Download the Scratch 2.0 offline editor. (http://scratch.mit.edu/scratch2download/)
I couldn't use the applet tag because I was using Scratch 2.0 which uses flash rather than java applets.
- junebeetle
-
Scratcher
100+ posts
Hosting Scratch 2.0 SWF on your own server.
I programmed a converter that displays a dialog where you choose an sb2 and then it saves it to swf.
- junebeetle
-
Scratcher
100+ posts
Hosting Scratch 2.0 SWF on your own server.
I programmed a converter that displays a dialog where you choose an sb2 and then it saves it to swf.I can't share it because it would violate the Scratch and Adobe Flex licenses though

- Blueinkproductions
-
Scratcher
1000+ posts
Hosting Scratch 2.0 SWF on your own server.
How?I programmed a converter that displays a dialog where you choose an sb2 and then it saves it to swf.I can't share it because it would violate the Scratch and Adobe Flex licenses though
- junebeetle
-
Scratcher
100+ posts
Hosting Scratch 2.0 SWF on your own server.
It actually probably wouldn't violate the Scratch license, but it might violate the Flex one. I'm not really sure. I'm not really clear on what you can and can't distribute…
- Discussion Forums
- » Advanced Topics
-
» Hosting Scratch 2.0 SWF on your own server.









