Are you a Flash developer? This comparison chart is for you! This chart is a quick reference to get you up to speed on how to do everything you know in Adobe Flash with Corona SDK.
Flash ActionScript is inherently object-oriented, often making it difficult to do the simplest of things. Corona SDK is based on the Lua language, which is flexible, easy, and powerful.
| ActionScript |
Processing API |
Corona SDK |
| lineStyle(strokeWidth, 0xFFFFFF); |
stroke(255); |
display.setDefault( "strokeColor", 255) |
| lineStyle(strokeWidth, 0xFFCC00); |
stroke(255, 204, 0); |
display.setDefault( "strokeColor", 255, 204, 0) |
| beginFill(0x006699); |
fill(0, 102, 153); |
display.setDefault( "fillColor", 0, 102, 153) |
| ActionScript |
Processing API |
Corona SDK |
| var line:Sprite = new Sprite();
addChild(line);
line.graphics.lineStyle(3,0xFFFFFF);
line.graphics.moveTo(0,20);
line.graphics.lineTo(80, 20); |
line(0, 20, 80, 20); |
line = display.newLine(0, 20, 80, 20) |
| var square:Sprite = new Sprite();
addChild(square);
square.graphics.beginFill(0xFFFFFF);
square.graphics.drawRect(0,0,30,30); |
rect(0, 0, 30, 30); |
square = display.newRect(0, 0, 30, 30) |
| var circle:Sprite = new Sprite();
addChild(circle);
circle.graphics.beginFill(0xFFFFFF);
circle.graphics.drawCircle(0,0,25); |
ellipse(0, 0, 25, 25); |
circle = display.newCircle(0, 0, 25) |
| ActionScript |
Processing API |
Corona SDK |
| var x:int = 70; // Initialize
x = 30; // Change value |
int x = 70; // Initialize
x = 30; // Change value |
x = 70 -- Initialize
x = 30 -- Change value |
| var x:Number = 70.5; // Initialize
x = 30; // Change value |
float x = 70.5; // Initialize
x = 30.0; // Change value |
x = 70.5 -- Initialize
x = 30 -- Change value |
| var a:Array = [5, 10, 11]; // Initialize
a[0] = 12; // Change value |
int[] a = { 5, 10, 11 }; // Initialize
a[0] = 12; // Change value |
a = { 5, 10, 11 } -- Initialize
a[1] = 12 -- Change value |
| ActionScript |
Processing API |
Corona SDK |
| for (var a:int = 45; a <= 55; a++) {
// Statements
} |
for (int a = 45; a <= 55; a++) {
// Statements
} |
for a = 45, 55 do
-- Statements
end |
| if (c == 1) {
// Statements
} |
if (c == 1) {
// Statements
} |
if c == 1 then
-- Statements
end |
| if (c != 1) {
// Statements
} |
if (c != 1) {
// Statements
} |
if c ~= 1 then
-- Statements
end |
| if (c < 1) {
// Statements
} |
if (c < 1) {
// Statements
} |
if c < 1 then
-- Statements
end |
| if (c >= 1) {
// Statements
} |
if (c >= 1) {
// Statements
} |
if c >= 1 then
-- Statements
end |
| if (c >= 1 && c < 20) {
// Statements
} |
if (c >= 1 && c < 20) {
// Statements
} |
if (c >= 1 and c < 20) then
-- Statements
end |
| 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
} |
if c >= 20 then
-- Statements 1
elseif c == 0 then
-- Statements 2
else
-- Statements 3
end |