| Test Available In FalconJx (+/-)? | ActionScript | JavaScript + Closure annotation | Notes |
---|---|---|---|---|
Global Constants |
|
|
|
|
Infinity | + | Infinity | Infinity |
|
-Infinity | + | -Infinity | -Infinity |
|
NaN | + | NaN | NaN |
|
undefined | + | undefined | undefined |
A table showing how each ActionScript language 'feature' is should be translated to Google Closure Tools assisted JavaScript by the FalconJS Compiler.
Using these AS3 references:
- Global Constants, Functions and Classes
- Statements, Keywords and Directives
Using Google Closure annotations:
- Annotating JavaScript for the Closure Compiler
Table quick navigation:
- coming soon ;-)
Legend for Javascript column color usage:
Black: JavaScript matches ActionScript
Red: solution not agreed upon
Blue: solution looks good, need consencus to approve (use Comments or Notes column)
Green: solution agreed upon
| Test Available In FlexJS (+/-)? | ActionScript | JavaScript + Closure annotation | Notes | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Global Constants |
| ||||||||||
|
|
| Infinity | - | Infinity | Infinity |
| ||||
-Infinity | - | -Infinity | -Infinity |
| |||||||
NaN | - | NaN | NaN |
| |||||||
Global Functions |
| undefined | - | undefined | undefined |
|
|
|
|
|
|
Global Functions |
|
|
|
| |||||||
Array() | - + | Array(...values) | new Array(...values) | There is no matching method in Javascript. Do we use a utility method that returns an array, or do we just use a 'new' Array object? |
| ||||||
Boolean() | + - | Boolean(value) | new Boolean(value) | See "Array" function note. | |||||||
decodeURI() | + - | decodeURI(value) | decodeURI(value) |
| |||||||
decodeURIComponent() | + - | decodeURIComponent(value) | decodeURIComponent(value) |
| |||||||
encodeURI() | + - | encodeURI(value) | encodeURI(value) |
| |||||||
encodeURIComponent() | + - | encodeURIComponent(value) | encodeURIComponent(value) |
| |||||||
escape() | + - | escape(value) | escape(value) |
| |||||||
int() | + - | int(value) | int(value >> 0) | ||||||||
isFinite() | + - | isFinite(value) | isFinite(value) |
| |||||||
isNaN() | + - | isNaN(value) | isNaN(value) |
| |||||||
isXMLName() | + - | isXMLName(value) | ? | There is no matching implementation in JavaScript. We may need to build a utility function to cover this one. | |||||||
Number() | + - | Number(value) | new Number(value) | See "Array" function note. | |||||||
Object() | + - | result = Object(value) ; | | In ActionScript, calling 'Object(value)' returns 'value' (since all values are objects). Given that, does it make sense to just write 'value' in JavaScript and let the Closure Compiler "cast" it? | |||||||
parseFloat() | - | parseFloat(value) | parseFloat(value) |
| |||||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8ab355f3-bfbd-4e64-88f2-463c669b7f15"><ac:plain-text-body><![CDATA[ | parseInt() | - | parseInt(value, [radix]) | parseInt(value, [radix]) |
| ]]></ac:plain-text-body></ac:structured-macro> | |||||
Object(value) |
| ||||||||||
parseFloat() | + | parseFloat(value) | parseFloat(value) |
| |||||||
parseInt() | + | parseInt(value, [radix]) | parseInt(value, [radix]) |
| |||||||
String() | + | String(value) | String(value) |
| |||||||
trace() | + | trace(...values) | trace(...values) | ||||||||
uint() | + | uint(value) | uint | String() | - | String(value) | new String(value) | See "Array" function note. | |||
trace() | - | trace(...values) | console.log(...values) | We may need a utility function to wrap 'console.log', as not all browsers have debugging enable, and calling to a non-existent 'console' object will cause an error. | |||||||
uint() |
| uint(value) | (value >>> 0) |
| |||||||
unescape() | - | unescape(value) | unescape(value) |
| |||||||
Vector() | - | result = Vector.<type>(valueArray); | | Let the Closure Compiler handle (check) what is basically a type cast from general Array to a Typed Array. | |||||||
XML() | - | XML(value) | ? | Use 'goog.dom.xml'? | |||||||
XMLList() |
| XMLList(value) | ? | Use 'goog.dom.xml'? | |||||||
|
|
|
|
| |||||||
Classes |
|
|
|
| |||||||
ArgumentError | - | ArgumentError | Error | Need utility class and cast a regular error object to that, for the sake of the Closure Compiler? | |||||||
arguments | - | arguments | arguments |
| |||||||
Array | - | Array | Array | Not sure if all properties and methods of AS Array class map to the JS Array class. | |||||||
Boolean |
| Boolean | Boolean |
| Class | - | |||||
Code Block | ActionScript | ActionScript | |||||||||
package com.example.components
{
public class MyClass
{
public function MyClass() {}
}
}
| |||||||||||
Code Block | Javascript | Javascript | |||||||||
goog.provide('com.example.components.MyClass');
/**
* @constructor
*/
com.example.components.MyClass = function() {};
| |||||||||||
unescape() | + | unescape(value) | unescape(value) |
| |||||||
Vector() | + | result = Vector.<type>(valueArray); |
| ||||||||
XML() | + | XML(value) |
| ||||||||
XMLList() | + | XMLList(value) | |||||||||
|
|
|
|
| |||||||
Classes |
|
|
|
| |||||||
ArgumentError | + | ArgumentError | ArgumentError | ||||||||
arguments | + | arguments | arguments |
| |||||||
Array | + | Array | Array | ||||||||
Boolean | + | Boolean | Boolean |
| |||||||
Class | + | - | - | ||||||||
Date | + | Date | Date | ||||||||
DefinitionError | + | DefinitionError | DefinitionError | ||||||||
Error | + | Error | Error | ||||||||
EvalError | + | EvalError | EvalError | ||||||||
Function | + | Function | Function |
| |||||||
int | + | int | int | ||||||||
JSON | + | JSON | JSON | ||||||||
Math | + | Math | Math |
| |||||||
Namespace | + | Namespace | Namespace | ||||||||
Number | + | Number | Number |
| |||||||
Object | + | Object | Object | ||||||||
QName | + | QName |
| ||||||||
RangeError | + | RangeError | RangeError | ||||||||
ReferenceError | + | ReferenceError | ReferenceError | ||||||||
RegExp | + | RegExp | RegExp | ||||||||
SecurityError | + | SecurityError | SecurityError | ||||||||
String | + | String | String | ||||||||
SyntaxError | + | SyntaxError | SyntaxError | ||||||||
TypeError | + | TypeError | TypeError | ||||||||
uint | + | uint | uint | ||||||||
URIError | + | URIError | URIError | ||||||||
Vector | + | Vector |
| ||||||||
VerifyError | + | VerifyError | VerifyError | ||||||||
XML | + | XML |
| ||||||||
XMLList | + | XMLList | |||||||||
|
| ||||||||||
Date | - | Date | Date | The JS class seems to be missing all the properties that the AS class offers. The methods on both classes match, AFAICT. | |||||||
DefinitionError | - | DefinitionError | Error | Need utility class and cast a regular Error object to that, for the sake of the Closure Compiler? | |||||||
Error | - | Error | Error | There is no 'errorID' property on the JS Error class | |||||||
EvalError | - | EvalError | EvalError | Need utility class and cast a regular Error object to that, for the sake of the Closure Compiler? | |||||||
Function | - | Function | Function |
| |||||||
int | - | int | Number |
| |||||||
JSON | - | JSON | JSON | How about support for "older" browsers? Do we provide "if not JSON, add custom JSON to window object"? | |||||||
Math | - | Math | Math |
| |||||||
Namespace | - | Namespace | ? | Do we need a utility class? | |||||||
Number | - | Number | Number |
| |||||||
Object | - | Object | Object | "setPropertyIsEnumerable" not available on JS Object.prototype... | |||||||
QName | - |
|
|
| |||||||
RangeError |
|
|
|
| |||||||
ReferenceError |
|
|
|
| |||||||
RegExp |
|
|
|
| |||||||
SecurityError |
|
|
|
| |||||||
String |
|
|
|
| |||||||
SyntaxError |
|
|
|
| |||||||
TypeError |
|
|
|
| |||||||
uint |
|
|
|
| |||||||
URIError Arithmetic |
|
|
|
| |||||||
Vector + | + | + | + |
| VerifyError |
| |||||
-- | + | -- | -- |
| |||||||
/ | + XML | / | / |
| |||||||
++ | XMLList + | ++ | ++ |
| |||||||
% | + | % | % |
| |||||||
* | + Arithmetic | * | * |
| |||||||
- | + | - | - |
| |||||||
-- |
|
|
| / | |||||||
Arithmetic compound assignment |
|
|
|
| |||||||
+= | + | += | += |
|
| ||||||
/= | + | /= | /= |
| |||||||
%= | + | %= | %= |
| |||||||
*= | + | *= | *= |
| |||||||
-= | + | -= | -= |
| |||||||
|
|
|
|
| |||||||
Arithmetic compound assignment Assignment |
|
|
|
| |||||||
= | + | = | = |
| |||||||
|
| /= |
|
|
| ||||||
| %= Bitwise |
|
|
|
| ||||||
*= & | + | & | & |
| |||||||
-= << | + | << | << |
| |||||||
~ | + | ~ | ~ |
| |||||||
Assignment | | + | | | | |
| |||||||
= >> | + | >> | >> |
| |||||||
>>> | + | >>> | >>> |
| |||||||
Bitwise ^ | + | ^ | ^ |
| |||||||
& |
|
|
| << | |||||||
Bitwise compound assignment |
|
|
| ~ | |||||||
&= | + | &= | &= |
| |||||||
<<= | + | <<= | <<= |
|
|
| |||||
|= | + | |= | |= |
| |||||||
>>= | + | >>= | >>= |
| |||||||
>>>= | + | >>>= | >>>= |
| |||||||
^= | + | ^= | ^= |
| |||||||
|
|
|
|
| |||||||
Bitwise compound assignment Comment |
|
|
|
| &= |
| |||||
/**/ | + | /**/ | /**/ |
| |||||||
// | <<= + | // | // |
| |||||||
|= |
|
|
|
| |||||||
>>= Comparison |
|
|
|
| |||||||
>>> == | + | == | == |
| |||||||
^= > | + | > | > |
| |||||||
>= | + | >= | >= | Comment | |||||||
!= | + | != | != |
| /../ | ||||||
< | + | < | < |
|
|
| / | ||||
/ <= | + | <= | <= |
| |||||||
=== | + |
| === | === | Comparison | ||||||
!== | + |
|
|
| !== | !== |
| ||||
| > |
|
|
| |||||||
| >= Logical |
|
|
| ! | ||||||
= && | + | && | && | < | |||||||
&&= |
|
| + | x &&= y |
| ||||||
! <= | + | ! | ! |
| === |
|
| ||||
|| | + | || | || |
| |||||||
! ||= = |
|
| + | x ||= y |
| ||||||
|
|
|
|
| |||||||
Logical Other |
|
|
| & | |||||||
[] & | + | [] | [] |
| |||||||
&&= as | + |
| as |
| |||||||
! , | + | , | , | | | |||||||
| ?: |
|
|
|
| |||||||
||= |
|
|
|
| |||||||
|
|
|
|
| |||||||
Other |
|
|
|
| |||||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f1d0fe95-c9c5-40ed-ad56-26380868d8f0"><ac:plain-text-body><![CDATA[ | [] |
|
|
|
| ]]></ac:plain-text-body></ac:structured-macro> | |||||
as |
|
|
|
| |||||||
, |
|
|
|
| |||||||
?: |
|
|
|
| |||||||
delete |
|
|
|
| |||||||
. |
|
|
|
| |||||||
in |
|
|
|
| |||||||
+ | (value) ? true : false; | (value) ? true : false; |
| ||||||||
delete | + | delete | delete |
| |||||||
. | + | . | . |
| |||||||
in | + | in | in |
| |||||||
instanceof | + | instanceof | instanceof | ||||||||
is | + | is | ? | ||||||||
:: | + | :: | ? |
| |||||||
new | + | new | new |
| |||||||
{} | + | {} | {} |
| |||||||
() | + | () | () |
| |||||||
/ | + | / | / |
| |||||||
: | + | : |
| ||||||||
typeof | + | typeof | typeof | ||||||||
void | + | void | void instanceof |
| |||||||
|
| is |
|
| |||||||
String |
| :: |
|
|
| ||||||
+ | new + | + | + |
| |||||||
+= | {} + | += | += |
| |||||||
" | () + | " | " |
| |||||||
/ |
|
|
|
| |||||||
: XML |
|
|
|
| |||||||
typeof @ | - |
|
|
| |||||||
void |
|
|
|
| |||||||
|
|
|
|
| |||||||
String |
|
|
|
| |||||||
+ |
|
|
|
| |||||||
+= |
|
|
|
| |||||||
" |
|
|
|
| |||||||
|
|
|
|
| |||||||
XML |
|
|
|
| |||||||
@ |
|
|
|
| |||||||
{} |
|
|
|
| |||||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2cd72d14-fb1b-4759-80e4-1f7c97c06f72"><ac:plain-text-body><![CDATA[ | [] |
|
|
|
| ]]></ac:plain-text-body></ac:structured-macro> | |||||
+ |
|
|
|
| |||||||
+= |
|
|
|
| |||||||
delete |
|
|
|
| |||||||
.. |
|
|
|
| |||||||
. |
|
|
|
| |||||||
() |
|
|
|
| |||||||
<> |
|
|
|
| |||||||
|
|
|
|
| |||||||
Statements |
|
|
|
| |||||||
break |
|
|
|
| |||||||
case |
|
|
|
| |||||||
continue |
|
|
|
| |||||||
default |
|
|
|
| |||||||
do...while |
|
|
|
| |||||||
else |
|
|
|
| |||||||
for |
|
|
|
| |||||||
@ | |||||||||||
{} | - | {} |
| ||||||||
[] | - | [] |
| ||||||||
+ | - | + | |||||||||
+= | - | += | |||||||||
delete | - | delete | |||||||||
.. | - | .. | |||||||||
. | - | . | |||||||||
() | - | () | |||||||||
<> | - | <> |
| ||||||||
|
|
|
|
| |||||||
Statements |
|
|
|
| |||||||
break | + | break | break |
| |||||||
case | + | case | case |
| |||||||
continue | + | continue | continue |
| |||||||
default | + | default | default |
| |||||||
do...while | + | do...while | do...while |
| |||||||
else | + | else | else |
| |||||||
for | + | for | for |
| |||||||
for...in | + | for...in | for...in |
| |||||||
for each...in | + | for each...in |
| ||||||||
if | + | if | if |
| |||||||
label | + | label | label |
| |||||||
return | + | return | return |
| |||||||
super | + | super([arg1, ..., argN]); |
| ||||||||
switch | + | switch | switch |
| |||||||
throw | + | throw | throw |
| |||||||
try...catch...finally | + | try...catch...finally | try...catch...finally |
| |||||||
while | + | while | while |
| |||||||
with | + | with | with |
| |||||||
|
|
|
|
| |||||||
Attribute Keywords for...in |
|
|
|
| |||||||
dynamic | + | dynamic | See "diff" page for each...in |
| |||||||
final | + |
| final |
| |||||||
internal | + |
| internal | See "diff" page... label |
| ||||||
native |
|
| [not user accessible] | return |
|
| |||||
override | + | super | override |
| |||||||
private | + |
| private | See "diff" page... switch |
| ||||||
protected | + |
| protected | See "diff" page... throw |
| ||||||
public | + |
| public | See "diff" page try...catch...finally | |||||||
static | + |
|
| static | See "diff" page... while |
| |||||
|
|
| with |
|
| ||||||
Definition keywords |
|
|
|
|
|
| |||||
Attribute Keywords |
|
|
|
| |||||||
dynamic |
|
|
|
| |||||||
final |
|
|
|
| |||||||
internal |
|
|
|
| |||||||
native |
|
|
|
| |||||||
override |
|
|
|
| |||||||
private |
|
|
|
| |||||||
protected |
|
|
|
| |||||||
public |
|
|
|
| |||||||
static |
|
|
|
| |||||||
|
|
|
|
| |||||||
... (rest) parameter | + | ...rest | |||||||||
class | + | class |
| ||||||||
const | + | const |
| ||||||||
extends | + | extends |
| ||||||||
function | + | function | function |
| |||||||
get | + | get |
| ||||||||
implements | + | implements |
| ||||||||
interface | + | interface |
| ||||||||
namespace | + | namespace |
| ||||||||
package | + | package |
| ||||||||
set | + | set |
| ||||||||
var | + | var | var Definition keywords |
| |||||||
|
| ... (rest) parameter |
|
| |||||||
Directives | class |
|
|
| |||||||
default xml namespace | const - |
| default xml namespace |
| |||||||
import | extends + |
| import |
| |||||||
include | function - |
| include |
| |||||||
use namespace | get - |
| use namespace |
| |||||||
| implements |
|
|
|
| ||||||
interface Namespaces |
|
|
|
| |||||||
namespace AS3 | - | ? |
|
| |||||||
package |
|
|
|
| |||||||
set |
|
|
|
| |||||||
? | |||||||||||
flash_proxy | - | ? | ? | ||||||||
object_proxy | - | ? | ? | ||||||||
|
|
|
| ||||||||
|
|
|
|
| |||||||
Directives |
|
|
|
| |||||||
default xml namespace |
|
|
|
| |||||||
import |
|
|
|
| |||||||
include |
|
|
|
| |||||||
use namespace |
|
|
|
| |||||||
|
|
|
|
| |||||||
Namespaces |
|
|
|
| |||||||
AS3 |
|
|
|
| |||||||
flash_proxy |
|
|
|
| |||||||
object_proxy |
|
|
|
| |||||||
|
|
|
|
| |||||||
Primary expression keywords |
|
|
|
| |||||||
false |
|
|
|
| |||||||
null |
|
|
|
| |||||||
this |
|
|
|
| |||||||
true |
|
|
|
| |||||||
|
|
|
|
| |||||||
OLD |
|
|
|
| Inheriting |
| |||||
Code Block | ActionScript | ActionScript | |||||||||
package com.example.components{
import org.apache.flex.Button;
public class MyClass extends Button
{
public function MyClass()
{
super();
}
}
}
| |||||||||||
Code Block | Javascript | Javascript | |||||||||
goog.provide('com.example.components.MyClass');
goog.require('org.apache.flex.Button');
/**
* @constructor
* @extends {org.apache.flex.Button}
*/
com.example.components.MyClass = function() {
goog.base(this);
};
goog.inherits(com.example.components.MyClass, org.apache.flex.Button);
|
| ||||||||||
| |||||||||||
Primary expression keywords |
|
|
|
| |||||||
false | + | false | false |
| |||||||
null | + | null | null |
| |||||||
this | + | this |
| ||||||||
true | + | true | true |
| |||||||
| |||||||||||
Implementing |
| TBD | TBD |
| |||||||
Inheriting + Implementing |
| TBD | TBD |
| |||||||
|
|
|
|
| |||||||
Fields |
|
|
|
| private |
|
Code Block |
---|
private var _myVar:String = "";
|
Code Block |
---|
/**
* @private
* @type {string}
*/
this._myVar = '';
|
protected
This is how far I got today ;-)
public
Global Constants