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

#1 2008-09-19 03:36:33

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Scratch on Flash -- Really... really... Alpha

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

 

#2 2008-09-19 04:02:55

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

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!


Jens Mönig

Offline

 

#3 2008-09-19 10:58:26

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

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  big_smile


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#4 2008-09-19 15:04:40

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#5 2008-09-20 00:21:33

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#6 2008-09-20 04:43:56

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

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?


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#7 2008-09-20 17:50:11

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

This is awesome

Offline

 

#8 2008-09-21 13:04:05

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#9 2008-09-21 13:28:30

adriangl
Scratcher
Registered: 2007-07-02
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

This is........ big_smile ! Scratch....on Flash! It is amazing. LIke JSO said, it would be awsome if you published the source code.


Scratchin' since 2007

Offline

 

#10 2008-09-21 19:33:07

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#11 2008-09-21 20:01:06

adriangl
Scratcher
Registered: 2007-07-02
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

This is great!  big_smile

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.


Scratchin' since 2007

Offline

 

#12 2008-09-22 02:28:06

VanMaxus
Scratcher
Registered: 2008-09-22
Posts: 1

Re: Scratch on Flash -- Really... really... Alpha

I have one question, I ma wondering is it possible to upload flash movies as a background to the scratch animations?

Offline

 

#13 2008-09-22 13:10:43

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

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.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#14 2008-09-22 13:12:53

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#15 2008-09-22 18:20:50

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

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  lol ). I'm going to look at the source right now...


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#16 2008-09-23 09:10:37

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Scratch on Flash -- Really... really... Alpha

Astonishing, some of my basic projects actually work nearly glitchless!

Offline

 

#17 2008-09-23 21:01:54

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

Astonishing indeed  smile

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

 

#18 2008-09-23 21:09:31

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

I think u should get key input up as fast as u can, because most scratch stuff uses that

Offline

 

#19 2008-09-24 12:02:59

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#20 2008-09-24 15:47:32

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#21 2008-09-24 16:35:36

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

This is incredible! You are amazing!

Offline

 

#22 2008-09-24 16:50:32

parseroo
Scratcher
Registered: 2008-09-05
Posts: 20

Re: Scratch on Flash -- Really... really... Alpha

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

 

#23 2008-10-03 22:03:29

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

Any more progress? I'm really interested in this, I think it could turn out amazingly.

Offline

 

#24 2008-10-20 02:18:58

christo
Scratcher
Registered: 2007-06-08
Posts: 2

Re: Scratch on Flash -- Really... really... Alpha

Top notch. Respect.

Offline

 

#25 2008-10-25 00:55:49

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Scratch on Flash -- Really... really... Alpha

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


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

Board footer