The actionscript side

Hi, the wiki seems to jump in in the middle. My kid has some scratch games, it would be great if he could make one scratch game that has all of these as levels.

I didn't know that it is possible for one game to communicate with another, that is just what he needs.

I got hold of Flash CS4, and I note that it is possible to add an .swf file to the stage and communicate with it using actionscript, and set the flashvars etcetera.

Is this how to get started? When I put PlayerOnly.swf on the 'stage' in Flash CS4 it gives error 1009 which is because the 'stage' is defined as null.

The solution to this is to stop the .swf from running the moment either INIT or COMPLETE fire. But neither of these events fire, the error 1009 happens before these events fire. Hence there is no event that can be used to stop it from running.

This wiki. the section on 'The Actionscript Side' says that one needs an actionscript editor, great. But what do we write using that actionscript editor?

Has someone got an example of actionscript code that successfully interacts with PlayerOnly.swf? A simple working example saying what to do first?

Or, has anyone managed to put PlayerOnly.swf on the 'stage' in Adobe's Flash without getting stuck with the error 1009 problem?
Comix6 (talk | contribs) 00:21, 25 April 2012 (UTC)

Hmm.. it looks like an interesting problem you have at hand. Sadly though, this isn't my area of expertise, and the wiki isn't really a place to ask for help (we're definitely nice people, but talk pages are usually for discussion about improving the article). I would recommend you try posting a topic in the Advanced Topics section of the Scratch Forums - see here (and click link on the top right hand corner named "Post new topic"). It's more likely you will get a response if you post there. Here is a link to the topic of a person who also had problems with connecting ActionScript to Scratch - maybe there you will find your solution? I also posted a comment on a project the user who created this article, named "Fullmoon" - he might have knowledge about the topic. Maybe he'll notice and be able to give you a response. Good luck!
Lucario621 (talk | contribs) 00:50, 25 April 2012 (UTC)
I think comix6 already posted a topic in the forums about this.
Scimonster (talk | contribs) 06:25, 25 April 2012 (UTC)


I'll reply to both comments. First, this actually is Victor's username, you can see his games as comix6, so I'm not misrepresenting myself. On the other hand, I can see that someone might misrepresent themselves (e.g. from Adobe corp) if they wanted to find ways of subsuming Scratch into their corporate product. I don't want that to happen and hence if there is a solution that does not use Flash CS4 I would prefer that. But at the moment I can't see any other way of interpreting this wiki.

Maybe a better or more general question is what the wiki is about in the first place. On the concept of improving the article: as it is the article makes no sense at all to me. It is an article like 'how to drive a car: you can drive a car fast or slow.'

But not saying where to put the key....admittedly I can't say how to improve it because I don't know how.

Comix6 (talk | contribs) 08:39, 25 April 2012 (UTC)

I've worked a lot with remote sensor connections, but not with Flash; so I see exactly what you meant. The essence of the article is as follows: you can connect a Scratch Program to a separate Flash program with remote sensor connections. It then shows you how to send and receive data. I'm not sure what exactly you are aiming to achieve, though. Can you explain that to me, please? Then I may be able to help. :) Thanks,
Hardmath123 (talk | contribs) 09:41, 25 April 2012 (UTC)

Hi Hardmath,

Thanks for your reply and explanation. Actually I see that you have already answered me on the forum!

My goal was for example that you let kids code their own javascript websites, similar to how some of them make javascript games already. And they can have more than one embedded project, and they are able to make that when you click a character in project 1, a character in project 2 says 'Hello World.'

I think, of the solutions you describe, probably stringing together several flash projects in a single html would be best but maybe not possible...
Comix6 (talk | contribs) 20:48, 25 April 2012 (UTC)

I suspect that by PlayerOnly.swf you're referring to the beta Flash player that Scratch is now using. Unfortunately, the Scratch Connections protocol has only been implemented for the native Scratch 1.4 application. Anyway, I don't think that this article really addresses your problem. You're looking to connect several Scratch projects, something that is easy enough to do with sockets in AS but isn't covered here. I would look into Snyff, a small executable that connects projects automatically. Best of luck!
Fullmoon (talk | contribs)

AS3 ad

The first paragraph is just the advantages of using Actionscript and doesn't have anything to do with Scratch. Who votes we change that?
GameHutSoftware (talk | contribs) 23:45, 28 November 2011 (UTC)

I vote it shouldn't be changed because it gives important background information about ActionScript. If it is removed the reader will not know what ActionScript is.
Bsteward (talk | contribs) 23:49, 28 November 2011 (UTC)
Right, but the tutorial says that it assumes you have basic Actionscript ability.
GameHutSoftware (talk | contribs) 23:52, 28 November 2011 (UTC)
+1 for removing it. It doesn't appear to be useful to the article at all.
WeirdF (talk | contribs) 23:56, 28 November 2011 (UTC)
+1, it's like an ActionScript advertisement :P
Jonathanpb (talk | contribs) 04:37, 29 November 2011 (UTC)
Yeah, that's what it is. :P
I removed it, and also the Flash logo.
Scimonster (talk | contribs) 09:06, 29 November 2011 (UTC)

Written weirdly...

This article is written more like a forum post than a wiki article. Could someone go change that, perhaps?
Scimonster (talk | contribs) 09:06, 29 November 2011 (UTC)

It looks like a tutorial, not a forum post :3 I can see your point though.
Jonathanpb (talk | contribs) 05:30, 30 November 2011 (UTC)
Unfortunately that means we're going to use some regular expressions. If you don't know what a regular expression (often abbreviated RegExp or RegEx), don't fret; neither does the vast majority of the human race.


If you're keeping score at home, you'll know exactly what this code does.


Cool, huh?


But wait, there's more!




If you're too lazy to read any of this...

Those seemed to be some of the most noticeable to me...
Scimonster (talk | contribs) 08:14, 30 November 2011 (UTC)
Lol I skimmed a bit much I think >.< Sowwee, I agree with you now :P
Jonathanpb (talk | contribs) 09:06, 30 November 2011 (UTC)
I agree with scimonster, the article is too personal-sounding :P
Chrischb (talk | contribs) 09:18, 30 November 2011 (UTC)
The tutorial seems fine to me.
Bsteward (talk | contribs) 12:29, 30 November 2011 (UTC)
I see the parts written weirdly now. Can't somebody edit them to sound better.
Bsteward (talk | contribs) 12:39, 30 November 2011 (UTC)
I tried to help fix the article, but somebody who knows more about ActionScript should rewrite all of the parts that have this problem.
Bsteward (talk | contribs) 02:46, 7 December 2011 (UTC)

Sending Data to Scratch

It needs to be updated, the protocol used there is incorrect. I wrote the correct protocol in the "The protocol" section.
Hardmath123 (talk | contribs) 05:33, 25 April 2012 (UTC)