| Language \ Environment \ Comparison |

| Index \ Java \ ActionScript \ Lingo \ Python \ Design By Numbers ActionScript is the language written for Macromedia's Flash software. Flash was originally created as web animation software and ActionScript is integrated into a timeline representation. ActionScript is based on JavaScript and Processing is built on Java, so there are many similarities between these two languages. Below is a list pointing out defining comparisons and contrasts between the two systems: Drawing The ActionScript code for drawing is highly optimized and shapes are drawn to the screen faster than in Processing. This allows Flash applications to be large in pixel dimensions and make heavy use of transparency and antialiased graphics. Calculations ActionScript is very slow making calculations and Processing is therefore much better for applications containing large numbers of elements. Pixel Operations ActionScript was developed for vector drawing and therefore ignored the possibility of directly manipulating pixels. Processing provides functions and data structures for simply accessing the pixels of an image and creates the potential for writing many interesting programs. 3D ActionScript does not internally represent spatial structure in three dimensions, while the Processing drawing library is inherently 3-D. Objects ActionScript is inherently object-oriented, while Processing programs can be written in both a procedural and object-oriented style. This allows students learning with Processing to understand their initial programs without first understanding the object-oriented metaphor. A complete ActionScript Reference is available on the Macromedia website.

| Processing | ActionScript
| background(0); background(255); | N/A
| background(255, 204, 0); | N/A
| stroke(255); stroke(0); | lineStyle(x,0xFFFFFF,a) lineStyle(x,0x000000,a)
| stroke(255, 204, 0); | lineStyle(x,0xFFCC00,a)
| fill(0, 102, 153); | beginFill (0x006699, alpha); beginGradientFill(filltype, colors[], alphas, ratios, matrix);

| Processing | ActionScript
| point(30, 20); | moveTo(x1,y1); lineTo(x1,y1);
| line(0, 20, 80, 20); | moveTo(x1,y1); lineTo(x2,y2);
| rect(10, 20, 30, 30); | moveTo(10,20); lineTo(30,20); lineTo(30,30); lineTo(10,30);

| Processing | ActionScript
| setPixel(30, 20, 255); | N/A
| a = getPixel(60, 10); | N/A
| pixels[y*width+x] | N/A

| Processing | ActionScript
| int x = 70; // Initialize x = 30; // Change value | var x = 70; // Initialize x = 30; // Change value
| float x = 70.0; x = 30.0; | var x = 70.0; x = 30.0;
| int[] a = {5, 10, 11}; a[0] = 12; // Reassign | a = new Array{5,10,11}; a[0] = 12; // Reassign

| Processing | ActionScript
| void loop() { // Statements } | do { // Statements }
| for(int a=45; a<=55; a++) { // Statements } | for(a=45; a<=55; a++) { // Statements }
| if(c==1) { // Statements } | if(c==1) { // Statements }
| if(c!=1) { // Statements } | if(c!=1) { // Statements }
| if(c < 1) { // Statements } | if(c < 1) { // Statements }
| if(c >= 1) { // Statements } | if c >= 1: # Statements
| if((c >= 1) && (c < 20)) { // Statements } | if((c >= 1) && (c < 20)) { // Statements }
| if(c >= 20) { // Statements 1 } else if (c == 0) { // Statements 2 } else { // Statements 3 } | if(c >= 20) { // Statements 1 } else if (c == 0) { // Statements 2 } else { // Statements 3 }

| Processing | ActionScript
| // Comment | // Comment
| void doIt(int x) { // Statements } doIt(x); | function doIt(int x) { // Statements } doIt(x);
| int square(int x) { return x*x; } square(X); | function square(int x) { return x*x; } square(x);

| Processing | ActionScript
| mouseX mouseY mousePressed | _Xmouse _Ymouse N/A
| void mousePressed() { // Statements } | mice = new Object(); mice.onMouseDown = function() { // Statements }
| (key=='a') (key=='b') ... | (chr(key.getAscii()) == 'a') (chr(key.getAscii()) == 'b') ...
| void keyPressed() { // Statements } | key = new Object(); key.onKeyDown = function() { // Statements }
| hour() minute() second() | now = new Date(); now.getHours() now.getMinutes() now.getSeconds()

| Processing >> ActionScript by JimQode, Martin, XemonerdX, Dara

| © 2002, 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea |
| Processing is an open project initiated by Ben Fry and Casey Reas |