We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Q:Converting to Actionscript?
Pages: 1 2 
Q:Converting to Actionscript?? (Read 2589 times)
Q:Converting to Actionscript??
Sep 27th, 2005, 11:49pm
 
Hi
I'm somewhat of a newcomer to Processing with a strong as2 background. I was wondering if anyone has done any conversion of processing code to actionscript and what is involved?
Any examples you'd care to share?
I know it makes more sense to convert the other way but I'd like to be able to leverage and work I've done and port it back into Flash if possible.
Thanks in advance.
Jim Bachalo
Re: Q:Converting to Actionscript??
Reply #1 - Oct 5th, 2005, 5:10am
 
Hey Jim
It doesn't make a whole lot of sense to do a direct port to Actionscript from Processing. The problem being that the two paradigms of programming are very different.

In Actionscript you have code seperated into movieclips, frames, and other things that can have code.

In Processing, you have code all in one place, and you draw directly to canvas. This itself is not how Actionscripting works, and thus inevitably you're going to run into major problems doing any sort of direct code porting.

That said, it is possible to port parts of projects over if you know how both environments work and exactly what to do. It's more of a manual process than you'd probably imagine, though, and it really depends on the project you are working on.
Re: Q:Converting to Actionscript??
Reply #2 - Nov 1st, 2005, 2:44pm
 
Need it really be all that different? I'd've thought most Processing programs could be translated fairly directly into AS - what am I missing?
Re: Q:Converting to Actionscript??
Reply #3 - Nov 1st, 2005, 3:55pm
 
from Flash: Movieclips/rendering concepts
from P5: 3D and Performance Smiley
Re: Q:Converting to Actionscript??
Reply #4 - Nov 3rd, 2005, 3:32pm
 
Call me a nutter, but I'd dearly love to see Processing exporting direct to .swf files. There isn't any reason why it would be impossible in principle, is there?
Re: Q:Converting to Actionscript??
Reply #5 - Nov 3rd, 2005, 3:37pm
 
I think there are many functions that ActionScript just doesn't provide at all, like any form of 3d AFAIK, it also doesn't allow access to pixels, so any sketch that does that won't work, it'll also not support any of the libraries.

So, for the odd sketch it may be possible to convert by hand, but I seriously doubt there'll ever be a generic "to Actionscript" export option, as the two syatems are jsut too different.
Re: Q:Converting to Actionscript??
Reply #6 - Nov 6th, 2005, 9:06pm
 
Java doesn't have any native support for 3D either, unless you  count Java3D, which Processing doesn't seem to use. Neither does it provide any direct access to individual pixels, a bizarre oversight I always thought. I'm not that clear on exactly what Processing is doing to do this (editing image objects and then putting them on the screen...?) but are you sure that it wouldn't be possible to do something very similar in AS?
Re: Q:Converting to Actionscript??
Reply #7 - Feb 19th, 2006, 2:41pm
 
while it actually *might* be possible to mirror a large part of processing's java classes in as2 i would rather doubt that you would arrive at something usable beyond pretty basic stuff. performance being one of the main reasons.

s.
Re: Q:Converting to Actionscript??
Reply #8 - Jun 29th, 2006, 12:25am
 
You know, considering the advantages, I'd really, really like to see someone attempt this, even though Brevity is attempting something similar. I wish I had the time myself.

I've been reading Keith Peters' excellent 'Foundation Actionscript Animation', and it seems clear enough that BitmapData objects provide the requisite degree of pixel-level graphics control, and the problem of doing 3D stuff is far from insurmountable. There might be performance issues with a lot of stuff, but I've seen smoothly running Flash things as complicated as anything I've done, and 90% of what I've seen in Processing, so I wouldn't take that as a given.

Anyway... just throwing in my tuppenceworth, in the vague hope that one day someone might pick it up.
Re: Q:Converting to Actionscript??
Reply #9 - Jun 29th, 2006, 2:24pm
 
Flash pixel fun, inspired by processing

http://www.adobe.com/devnet/flash/articles/webcam_motion_03.html
Re: Q:Converting to Actionscript??
Reply #10 - Jun 29th, 2006, 5:17pm
 
If nobody has done this before, a possibility to export processing application to an swf would be to write a library which translate each processing method into actionscript code and create the .as file (would be a lot of work).  

then use the free MTASC actionScript compiler
www.mtasc.org to compile the action script file into swf.

This is just a thought, maybe there are other ways, anyway, it would be an interesting challenge to write such an exporter. On the other side, why not just use actionscript directly if the goal is to have a flash movie
Re: Q:Converting to Actionscript??
Reply #11 - Jul 1st, 2006, 12:11pm
 
Quote:
On the other side, why not just use actionscript directly if the goal is to have a flash movie


Well... for exactly the same reason why people might prefer to use Processing rather than Java?

Plus, this would mean that once someone knows Processing, they can make Flash animations!

It would make Processing much more useful for creating things which people can actually see in their web browsers, and which they're glad to see - rather than having to endure the crunching, unresponsive wait for Java to load just so that someone can show them a pretty little swirly thing, which I know that some people resent.
Re: Q:Converting to Actionscript??
Reply #12 - Jul 1st, 2006, 4:00pm
 
Processing is actually java, you can see processing as a Java framework for programming images, animation , sounds. Take a look at what heapens when you export your sketch, you actually did write a subclass of PApplet.

Quote:
Well... for exactly the same reason why people might prefer to use Processing rather than Java?  


The Processing environment handles all the low level things you need for programming graphics (2D/3D), sounds, etc in java and provides a high level API which you can use in your sketch, therefore it is more comfortable to code in processing for those purposes since you can invest your time and energy in the realization of your ideas.

I am also not sure if adobe would be happy to see swf movies in the internet created by processing Smiley , it is true that there are free action script compiler, but I'm not so sure if the action script itself is free to use for other purposes.

Quote:
Plus, this would mean that once someone knows Processing, they can make Flash animations!


why not spending time learning both of them Smiley  
Re: Q:Converting to Actionscript??
Reply #13 - Jul 4th, 2006, 4:18pm
 
Quote:
The Processing environment handles all the low level things you need for programming graphics (2D/3D), sounds, etc in java and provides a high level API which you can use in your sketch, therefore it is more comfortable to code in processing for those purposes since you can invest your time and energy in the realization of your ideas.


My point exactly. AS might already be higher-level than Java, but it's still a bit of a pain in various ways.

Quote:
I am also not sure if adobe would be happy to see swf movies in the internet created by processing Smiley , it is true that there are free action script compiler, but I'm not so sure if the action script itself is free to use for other purposes.


Well, have they given any other Open Source Flash projects any serious trouble

Quote:
why not spending time learning both of them


Why not spend time learning Java Or making cool things, rather than spending yet more time learning how to make them

Also - it's pretty awkward to really learn ActionScript without shelling out for a copy of Flash, and from the point of view of someone who isn't rich and isn't making money out of Flash, it's not cheap!

*resolves to get the hang of compiling AS using Eclipse anyway*
Re: Q:Converting to Actionscript??
Reply #14 - Jul 5th, 2006, 1:44am
 
Quote:
Also - it's pretty awkward to really learn ActionScript without shelling out for a copy of Flash

this is true, a workaround would be (as you mention) compiling AS in Eclipse with alternative as compiler.

To get back to the point you have mentioned above, about a format for the internet which doesn't take time to load ... I actually was also looking for some possibilities for a while. I finally came up start playing with SVG and javascript.

There is also a nice open source java SVG framework  http://xmlgraphics.apache.org/batik/ which has a set of core modules to support specific SVG solution and the mozilla rhino javascript engine for java is also embedded.


so, combinig this together, it is possible to create a development environment focuses on exporting SVG using javascript, this environment could also have a  buildin framework since the rhino javascript engine allows to add custom javascript functions to the engine.

Maybe this kind of procedure can be integrated in processing somehow
Pages: 1 2