In the spirit of release early and often...
I have made a full bottom-to-top pass at implementing Scratch in Flash. It can:
* Read a scratch project file
* Create the project model (Stage, Sprites, Blocks, etc.)
* Run that model (the core variable assignments, loops, etc.)
* And do a couple of the other kinds of Sprite blocks in the 'motion' and 'looks' categories
It most definitely does not:
* Respond to mouse or key events yet (but that is trivial to finish...)
* Do all the blocks... this is going to take work to map them all into Flash and especially the Sound area could be problematic
* Draw things properly -- for one, the center of the stage is not 0,0 and the y axis is 'upside-down' [I said this was 'early']
* Run the model correctly for all control blocks. The core concepts are there and the blocks I have tested work right [and I picked interesting ones], but I have not tested beyond a couple projects
* Read the Sound media at all
* Show any of the Watchers -- Either variables or lists
=======================
But given those caveats and all that I have forgotten, there is a demo at Scratch on Flash
You put a project URL into the text area and click 'Open'. Then click 'Go!' and if your project responds to 'Go!' things may or may not start happening :-) Note that the URL is smart about shared projects on this site (and locates the '.sb' file automatically if you give it the project's url) but if you use a local file system URL or some other web site, you will need to have a full path to the '.sb' file.
The window has a console at the bottom, a textual dump of the program above that, and has a 'Step Processor' above that. By default the program is running one step every 30th of a second, but you can turn that off or make more steps occur every 30th of a second.
=======================
It could easily be that only the one project 'Tower of Hanoi' does anything interesting... probably within a short time some other projects would work too. By default, I would probably start picking and choosing among Tutorials or the included 'Projects' (is there a Gallery on the site for all the Included projects?).
I will release source in some format in the next release -- things are pretty clean and somewhat commented, but I think I should get a little further and make sure I am not going to rename or repackage anything. And I will need to strip out the few 'Flex' references from within the core Scratch model so a smaller SWF download is possible.
If anyone is interested in working on this -- doing Blocks and verifying that functionality is working, please let me know. If people are interested then I will put source into a public RCS like Subversion or Git sooner than later.
Offline
Wow, This is *amazing*, parseroo!
I just tried your flash player with the standard project (your towers of hanoi) it it actually worked, although the discs were a little bit off-placed (could be my ancient computer's fault, though). I even got it to load a simple project of mine. Being able to set the steps per frame looks very promising. This is one project to follow closely!
Offline
Wow!
I really like this!
The disc where off placed - but I now understand the sprites are on the flash x,y values, starting from the upper left corner.
Is this difficult to fix? I thought it's possible by just adding "225-realx" or something like that. Same for the wrong y axis: *-1?
However, it would be so cool if you could publish the source code...
However, it would be a wonderful alternative to the sluggish Java player
Offline
Fixing the coordinate system is easy and I will probably have that as part of the day's pass.
There is a somewhat related issue that sizing should scale around a scalePoint, but then that means positioning and scaling should be relative to the center of the sprite... so that is a bit harder. I will probably try to finish all the 'moves' and most of the 'looks' as the next full pass and as soon as possible.
Offline
Changes for the day:
* Coordinate system is now correct although sizing and center-point are not
* Some better logging [new text area] which mostly shows what blocks are not implemented
* Mouse and Text events are now being processed -- so hats based on them should work
* Color-table graphics are working right (or better)... most notably Scratch the cat is rendered correctly I believe
And I forgot to mention, you can pass a 'purl' argument (Project URL) to the page and that will be the starting project in the 'open' section. For example:
* http://nowur.com/scratch/ScratchPlayer.html?purl=http://scratch.mit.edu/projects/parseroo/259590
And if you want it to auto-open, just add 'open=true'. Auto-start, add 'start=true'. So the following should show a horizontal smiley face at the top of the display area:
* http://nowur.com/scratch/ScratchPlayer.html?purl=http://scratch.mit.edu/projects/Paddle2See/202369&open=true&start=true
Last edited by parseroo (2008-09-20 02:09:21)
Offline
It's an amazing accomplishment! I am strarting to see Scratch on Flash!
I tried loading a couple of projects...and I get the message "Creating xx Objects" (where xx is a number) and then...nothing. Is there a second message when it is done creating objects and it is ready to run?
Offline
This is awesome
Offline
Paddle2See: If a project loads successfully, the left pane (under 'Step 1') will have a textual version of the program. If it fails, it used to be that nothing visible happened (unless you have a debugging version of Flash installed). I just put up a version that will put an error message into the logging area so you can see failures a bit more obviously.
I think some of your projects have a graphic format (e.g. the 'nature' backdrop) that the code is not parsing properly. I will try to look into it after I get a few other things done first. I would like all the graphic aspects to work ASAP.
Offline
A newer version is now available. I believe it has a reasonable (but preliminary) version of binding Scratch coordinate system, scaling, etc. to Flash display capabilities. Costume changes, show/hide, and most other look and motions work. But a few don't (no 'bounce', 'move toward ...'). And Pens / Sound / sensing blocks are not attempted yet.
Given I think the current code is reasonable in structure, I put it up on Google Code at:
* http://code.google.com/p/scratchonflash/
And the core of the Scratch code is at:
* http://code.google.com/p/scratchonflash/source/browse/#svn/ScratchPlayer/trunk/src/com/chimu/scratchplayer
Note that I am not sure about the license -- so consider that license (the MIT License) to be tentative because I had access to Scratch source in creating this project. I will ask that question to the scratch team in a separate topic.
Offline
This is great!
parseroo wrote:
A newer version is now available. I believe it has a reasonable (but preliminary) version of binding Scratch coordinate system, scaling, etc. to Flash display capabilities. Costume changes, show/hide, and most other look and motions work. But a few don't (no 'bounce', 'move toward ...'). And Pens / Sound / sensing blocks are not attempted yet.
Given I think the current code is reasonable in structure, I put it up on Google Code at:
* http://code.google.com/p/scratchonflash/
And the core of the Scratch code is at:
* http://code.google.com/p/scratchonflash/source/browse/#svn/ScratchPlayer/trunk/src/com/chimu/scratchplayer
Note that I am not sure about the license -- so consider that license (the MIT License) to be tentative because I had access to Scratch source in creating this project. I will ask that question to the scratch team in a separate topic.
Offline
VanMaxus wrote:
I have one question, I ma wondering is it possible to upload flash movies as a background to the scratch animations?
Nope. Try converting your flash to an animated gif or picture sequence instead.
Offline
The flash player uses the same source 'sb' file as the main editor and java player, so it only supports the same media as they do.
When a 'pure player' (the current one is a debugging version) is finished, you might be able to have a transparent stage background and overlay the flash player on top of another HTML page element, which could be a flash movie or video or something.
And if you hack the player -- you could do pretty much whatever you wanted :-) A project I thought of: add the ability to have non-Scratch Flash Sprites that can listen to and send Scratch broadcasts. Kind of like an in-shared-space version of the scratch communication protocol.
Offline
This is incredible! It's interesting to see someone take Scratch to Flash (I do a lot of graphics in Flash, then port them over to Scratch, then, if you continue work on this, back into Flash
). I'm going to look at the source right now...

Offline
Astonishing, some of my basic projects actually work nearly glitchless!
Offline
Astonishing indeed
A version with a pass at Pens and Stamps is up at:
* http://nowur.com/scratch/ScratchPlayer.html
* http://code.google.com/p/scratchonflash/
I also created a gallery where people can add projects they think would be good to prove and disprove whether ScratchOnFlash is working properly. It is at:
* http://scratch.mit.edu/galleries/view/29151
And in case people did not notice, there is a short Design Summary wiki page at:
* http://code.google.com/p/scratchonflash/wiki/DesignOverview
Offline
I think u should get key input up as fast as u can, because most scratch stuff uses that
Offline
Key input should be working fine. I believe all the 'When' hats are working -- have been since first release. I test with a project that responds to key events, so I am pretty sure those all work unless one of my 'name' -> 'character' mappings is wrong. Basically the status is:
* Motion : 90% -- Missing bounce and point towards
* Looks : 50% -- Has costumes, size, show/hide, and one effect. But no 'Say' or layers
* Sound: 0%
* Pen: 80%+ -- Has stamps and pens but no 'change shade'
* Control: 100%
* Sensing: 0%
* Numbers: 90% -- Missing the named functions ('sqrt') ... this would be trivial to finish
* Variables: 100%
Or sorted the other way, current status is something like this:
* Control: 100%
* Variables: 100%
* Numbers: 90% -- Missing the named functions ('sqrt') ... this would be trivial to finish
* Motion : 90% -- Missing bounce and point towards
* Pen: 80%+ -- Has stamps and pens but no 'change shade'
* Looks : 50% -- Has costumes, size, show/hide, and one effect. But no 'Say' or layers
* Sound: 0%
* Sensing: 0%
Offline
Two caveats to the 'Key Input should be working' -- (1) Arrow keys were not working... just fixed that. (2) There were times key events might not be heard [because of some obscure thing that I doubt people care about... but ask or see source code if you do care :-)]. I also just fixed that.
So there were two caveats and there now should be no caveats. At least no known ones.
Offline
The 90%s were bugging me, so I finished them off. Now should be:
* Control: 100%
* Variables: 100%
* Numbers: 100%
* Motion : 100%
* Pen: 80%+ -- Has stamps and pens but no 'change shade'
* Looks : 50% -- Has costumes, size, show/hide, and one effect. But no 'Say' or layers
* Sound: 0%
* Sensing: 0%
* Watchers: 0%
Offline
a few ?'s:
does this make scratch run as if it where written in flash (it can handle say 20-50 sprites at one time)?
would it be possible to post projects on something like newgrounds and it would run through the flash player?
a suggestion for this is to write something like this in C++ or Java which is reaching boundaries of where we can use 10,000 sprites at once, which would mean nobody would ever have to complain about scratch's running speed EVER again (unless there are some dopes who would find it fun to make it run 20,000 sprites and make a complaint)
I haven't downloaded it yet, and I won't until it's finished, but I'll be happy to know that I can now make games that will run at much more respectable speeds, can't wait for it to be done, I'll be able to use all the scripting techniques I've had to put to shame because they would use too much processing power
Offline