Discuss Scratch

stevetheipad
Scratcher
500+ posts

Sharing

A few questions on sharing projects on other websites:
1. When will this feature be implemented?
2. Is there a workaround to embed it on other websites now?
3. How do cloud variables work on external sites?

The reason I'm asking is actually unrelated to testing this alpha. I'm taking a class from Coursera (coursera.org) and one of the assignments is creating an interactive system to embed onto our own website created for the project. I need cloud variables for it so I can't use 1.4.
Lightnin
Scratcher
1000+ posts

Sharing

stevetheipad
A few questions on sharing projects on other websites:1. When will this feature be implemented?2. Is there a workaround to embed it on other websites now?3. How do cloud variables work on external sites?The reason I'm asking is actually unrelated to testing this alpha. I'm taking a class from Coursera (coursera.org) and one of the assignments is creating an interactive system to embed onto our own website created for the project. I need cloud variables for it so I can't use 1.4.

1. Before the release. (Not sure when though.)
2. Nope, (well maybe BoltBait has one?)
3. Good question! I'll ask Sayamindu.
BoltBait
Scratcher
1000+ posts

Sharing

You can look on my site to see what was required to get it working on IE:

http://www.boltbait.com/free/games/chess/

I could write it up if necessary.

Just so you know, I'm using v37 of the old style flash player as I find it more reliable than the new style player. But, getting it to work with the new player is the same.

Last edited by BoltBait (Oct. 22, 2012 17:17:51)

stevetheipad
Scratcher
500+ posts

Sharing

BoltBait
You can look on my site to see what was required to get it working on IE:http://www.boltbait.com/free/games/chess/I could write it up if necessary.Just so you know, I'm using v37 of the old style flash player as I find it more reliable than the new style player. But, getting it to work with the new player is the same.
What's the code to get it working?
BoltBait
Scratcher
1000+ posts

Sharing

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 regular 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 (Oct. 23, 2012 14:30:17)

stevetheipad
Scratcher
500+ posts

Sharing

BoltBait
if (isFirefox) w += 1;
Thanks!
BoltBait
Scratcher
1000+ posts

Sharing

Test it out and let me know if I missed anything.
stevetheipad
Scratcher
500+ posts

Sharing

Implemented! Yeeeeyaahh!
kysk219dhsaek102
Scratcher
79 posts

Sharing

OMG THIS POST IS SO OLD (No offense)
Botcho_Otkho
Scratcher
1000+ posts

Sharing

kysk219dhsaek102 wrote:

OMG THIS POST IS SO OLD (No offense)
Was there any need to bring this up like thos and necropost?
Za-Chary
Scratcher
1000+ posts

Sharing

Botcho_Otkho wrote:

kysk219dhsaek102 wrote:

OMG THIS POST IS SO OLD (No offense)
Was there any need to bring this up like thos and necropost?
Yes — so I could close it as implemented

Powered by DjangoBB