Skip to main content
Participating Frequently
January 24, 2014
Question

How can ActionScript 3 compile/interpret JavaScript directly

  • January 24, 2014
  • 1 reply
  • 2164 views

I am working in a Chinese gaming company and we are developing cross-platform games running on all major OS (Windows/Mac/iOS/Android) and broswers, including html5 and non-html5 browsers (e.g., ie6-9). We successfully published one commercial game so far. However we did encounter one performance problem that the game's performance running non-html5 browsers is not desirable. On ie 6-9, we used Trident to compile/interpret JS and we are wondering if ActionScript 3 can compile/interpret JS directly, and how can we do this?

This topic has been closed for replies.

1 reply

Inspiring
January 24, 2014

Since FlashCC the createJS Framework that was originally more of a plugin for  Flash, was integrated in Flash, so now you can directly write Javascript in Flash and use flashs drawing tools to draw on canvas. There is also a integrated "translator" that translates your actionscript code to Javascript, which -of course- has some caveats.

I am not sure what you mean by

if ActionScript 3 can compile/interpret JS directly

though.

If you ask if Flash is capable to use one sourcecode and target "all" of your mentioned platforms without adapting your code: no.

The createJS Framework pretty much depends on Canvas, it can`t produce any html4-compatible code.

Swf on Mobile has pretty much died since Adobe decided to abandon the Flashplayer for Android and the Apple-Controversy is History, of course.

From what I have heard the most flexible framework at the moment should be Haxe

especially for Gamedevelopers who dom`t need the 3D functionality Unity offers.

PetermanAuthor
Participating Frequently
February 8, 2014

1. "so now you can directly write Javascript in Flash and use flashs drawing tools to draw on canvas."

That is great. How can we use flashs drawing tools to draw on canvas in Flash? Can you give me some links or examples so I can study further?

2. My question also can be asked as "In Flash, how can I make Flash understand my JS code?"

PetermanAuthor
Participating Frequently
February 8, 2014

3. "so now you can directly write Javascript in Flash and..."

We are very excited on what you said above. We used Flash to resovle Html4 issues, not to resolve Html5 issues. So we are particularly concerned on how to directly write Javascript in Flash and run Javascript in Flash?  It is ok if CreateJS Framework can't produce any html4-compatible code. Is there anyway that other part of Flash can produce html4-compatible code? How can we write/run JS directly in Flash?