If someone were to take this and expand it, then yes, I suppose it could become 
possible to run a Flex 4 app in JS with very few changes.

What are these two doing? Well...

OpenFL is a reimplementation of the Flash API written in the Haxe programming 
language. Haxe can be compiled to JS. There's a version of OpenFL available 
that is pre-compiled to JS, so that JavaScript developers can use it. See here 
on NPM: https://www.npmjs.com/package/openfl

The Royale compiler is converting the AS3 source code of the Flex framework to 
JS. I used Flash's playerglobal.swc file with the external-library-path 
compiler option to trick the compiler into thinking that the Flash API was 
available in JS. It could also be done with OpenFL externs/typedefs written in 
AS3, but this was the fastest way for me to do it.

In my HTML file, I added the OpenFL JS library:

<script src="https://unpkg.com/[email protected]/dist/openfl.min.js";></script>

Then, I included this line of JS to make OpenFL look like Flash:

var flash = openfl;

There's a bit more involved in getting everything bootstrapped, and some random 
Flash APIs are missing from OpenFL, but that's the basic idea.

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>

On 2021/09/10 09:50:35, yushiro maeda <[email protected]> wrote: 
> Hello,
> 
> Thank you always, it's very interesting!!
> 
> 
> If what's happening here evolves after this, for example, can I automatically 
> convert code written in Flex4 directly to javascript without having to 
> rewrite it for Royale?
> 
> So is migration (Flex 4 to Royale) unnecessary?
> 
> I'd like you to tell me a little,
> It seems that both Royale and OpenFL convert from AS3 to Javascript in the 
> same way.
> 
> What are these two doing?
> 
> I would appreciate it if you could tell me.
> 
> thank you.
> 
> On 2021/09/09 20:19:57, Josh Tynjala <[email protected]> wrote: 
> > Hey community,
> > 
> > I just wanted to share a little demo I put together as a way of pushing the
> > capabilities of the Apache Royale compiler. Adobe Flex 2 (really, the
> > version from 2006!) running on OpenFL in JS.
> > 
> > https://joshblog.net/2021/adobe-flex-2-running-on-openfl-in-javascript-instead-of-swf/
> > 
> > --
> > Josh Tynjala
> > Bowler Hat LLC <https://bowlerhat.dev>
> > 
> 

Reply via email to