Index \ Java \ ActionScript \ Lingo \ Python \ Design By Numbers


ActionScript is the scripting language for Adobe's Flash software. Flash was originally created as web animation software and ActionScript can be 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 (except when using the OpenGL Library). This allows Flash applications to be large in pixel dimensions and make heavy use of transparency and antialiased graphics.

3D
ActionScript does not internally represent spatial structure in three dimensions, while the Processing drawing library is inherently 3D.

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 Adobe website.

Processing ActionScript 2.0
background(0);
background(255);
N/A
background(255, 204, 0); N/A
stroke(255);
lineStyle(x, 0xFFFFFF, a, true, "none", "round", "miter", 1);
stroke(255, 204, 0); lineStyle(x, 0xFFCC00, a, true, "none", "round", "miter", 1);
fill(0, 102, 153); beginFill (0x006699);
Processing ActionScript 2.0
point(30, 20); setPixel(30, 20, 0x000000)
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 2.0
int x = 70; // Initialize
x = 30; // Change value
var x:Number = 70; // Initialize
x = 30; // Change value
float x = 70.0;
x = 30.0;
var x:Number = 70.0;
x = 30.0;
int[] a = {5, 10, 11};
a[0] = 12; // Reassign
var a:Array = [5, 10, 11];
a[0] = 12; // Reassign
Processing ActionScript 2.0
for(int a=45; a<=55; a++) {
// Statements
}
for (var a:Number = 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 2.0
// Comment // Comment
void doIt(int x) {
// Statements
}

doIt(x);
private function doIt (x:Number):Void {
// Statements
}

doIt(x);
int square(int x) {
return x*x;
}

square(X);
function square(x:Number):Number {
return x*x;
}

square(x);
Processing ActionScript 2.0
mouseX
mouseY
_xmouse
_ymouse
void mousePressed() {
// Statements
}
// Create a mouse listener object
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
// Statements
};
Mouse.addListener(mouseListener);
if (key=='a') {
// Statements
}
if ((chr(key.getAscii()) == 'a') {
// Statements
}
void keyPressed() {
// Statements
}
var myListener:Object = new Object();
myListener.onKeyDown = function () {
// Statements
}
Key.addListener(myListener);

Processing >> ActionScript by JimQode, Martin, XemonerdX, Dara, Dr. Woohoo