I just got a much better idea! Using Flash 2.0 in a browser, you can actually save your project as a SB2 file. SB2 is just a ZIP file with some JSON, WAVs and PNGs.
The JSON file looks like this:
{
"objName": "Stage",
"sounds": [{
"soundName": "pop",
"soundID": 0,
"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
"sampleCount": 258,
"rate": 11025,
"format": ""
}],
"costumes": [{
"costumeName": "backdrop1",
"baseLayerID": 2,
"baseLayerMD5": "739b5e2a2435f6e1ec2993791b423146.png",
"bitmapResolution": 1,
"rotationCenterX": 240,
"rotationCenterY": 180
}],
"currentCostumeIndex": 0,
"penLayerMD5": "5c81a336fab8be57adc039a8a2b33ca9.png",
"penLayerID": 0,
"tempoBPM": 60,
"videoAlpha": 0.5,
"children": [{
"objName": "Sprite2",
"scripts": [[55,
24,
[["whenGreenFlag"], ["doRepeat", 10, [["forward:", 10], ["wait:elapsed:from:", 1]]]]]],
"sounds": [{
"soundName": "pop",
"soundID": 0,
"md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav",
"sampleCount": 258,
"rate": 11025,
"format": ""
}],
"costumes": [{
"costumeName": "costume1",
"baseLayerID": 1,
"baseLayerMD5": "e5c228e0b529cfcae5d5f34b7f69e1a5.png",
"bitmapResolution": 2,
"rotationCenterX": 8,
"rotationCenterY": 8
}],
"currentCostumeIndex": 0,
"scratchX": 26,
"scratchY": -7,
"scale": 1,
"direction": 90,
"rotationStyle": "normal",
"isDraggable": false,
"indexInLibrary": 1,
"visible": true,
"spriteInfo": {
}
}],
"info": {
"spriteCount": 1,
"scriptCount": 1,
"swfVersion": "",
"flashVersion": "",
"userAgent": "",
"videoOn": false,
"hasCloudData": false
}
}
You can see the code from Scratch in children -> * -> scripts
:
[["whenGreenFlag"], ["doRepeat", 10, [["forward:", 10], ["wait:elapsed:from:", 1]]]]]]
which you could convert to Arduino:
for (int i = 0; i < 10; ++i) {
forward(10);
delay(1000); // TODO: replace with non-blocking multi-threading
}
So, what do you think?
Does anyone want to work with me on this?