How to use modern Javascript in AIR?

Is there code that works on all platforms to run newer advanced Javascript? I know I can use native extensions but I’m hoping someone knows a different way. What ways are people currently using to run JS code?

admin edit:
do learn to pick a category for your posts

where do you try to run the JS code exactly ?

I want to use crypto libraries. All the open source AS3 crypto libraries are out dated and not compatible with newer crypto projects. When the user taps a button, I want to run the JS crypto code inside the app from an included .js file.

what do you mean by that ?

I mean the latest cryptocurrencies, like ethereum/rchain/tezos etc., all use cryptography code that is only implemented in Javascript. I need to include cryptography.js and then be able to call the Javascript functions at runtime.

either you try to run JS from HTML inside AIR or you try to run that JS code inside the AIR runtime

WHICH one is it ?

I only thought you could do JS from HTML inside AIR. Is it possible to do JS inside AIR sort of like command line. I don’t need user interface js features.

You can compile JS so it run inside AIR without the HTML

AIR can execute AS3, but AS3 is a superset of ECMAScript 3

so as long as the JS lib can work with ES3 it should be able to compile

see for ex
The case when you don’t want Node.js

You need to locate the ASC compiler in the Flex SDK or the AIR SDK

in the Flex SDK /lib/asc.jar (ASC1)
eg. $ java -jar asc.jar -help
or $ java -classpath asc.jar macromedia.asc.embedding.Main -help

in AIR SDK /lib/compiler.jar (ASC2)
eg. $ java -classpath compiler.jar com.adobe.flash.compiler.clients.ASC -help

and you will need to use it like that
$ java -jar asc.jar -ES -d -import frameworks/libs/air/ whatever.js

in short use -ES instead of -AS3 so it compile with the option

“use the ECMAScript edition 3 prototype based object model to allow dynamic overriding of prototype properties”

and import the (instead of airglobal.swc)

for whatever.js you need to take a JS library and compile it with TypeScript with
$ tsc --target ES3 --module CommonJS

you will probably get errors, but fix them one by one and ultimately you should be able to then produce a (abc is for ActionScript byte code)

if you get there then you will be able to use asc.jar to produce a SWF instead of an ABC
and there you just need to zip it as if it was a SWC

1 Like

Oh. I also should’ve mentioned I do not want to use FLEX either. Is FLEX required for this method? I think I should be able to understand those instructions and be able to play around with it. I want to be able to create these 24 word mnemonic phrases as seen here

It would be great if HARMAN or community could make newer open source AS3 crypto libraries. I could put up a small “crypto” bounty for community if anyone is interested.

there are different Flex

  • Flex the IDE
  • Flex the framework
  • Flex the SDK

the Flex SDK contains the compilers, you need the compilers to compile code

this got nothing to do with crypto libraries

Security And Privacy - What is a Mnemonic Phrase?

see Quick guide to generating addresses with NovaCrypto

imho doesn’t really work like that

I guess native extensions aren’t that bad, I can run the latest greatest Ethereum JS wallet code using native extensions. I just dislike how native extensizes breaks the universal code base. I’m looking into hardware wallets which will probably again require native extensions anyways. I will need them so the app can access stuff like NFC, USB-c, finger print, face id and Bluetooth.