ExternalInterface for JavaScript


#1

There is cool feature in the Adobe Flash - ExternalInterface
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

The ExternalInterface class is an application programming interface that enables straightforward communication between ActionScript and the SWF container– for example, an HTML page with JavaScript or a desktop application that uses Flash Player to display a SWF file.

Is it possible to implement something like this in Defold?


#2

There is nothing available right now but it is requested by multiple teams already and it will probably be given a high priority as soon as we’ve shipped the extension system and live update feature.


#3

Ok, thats good news. Thanks.


#4

Are there any chance to get the feature (in the most basic and simplest way) in the next month? We just stumbled into this contest and we’ll have to pass messages from javascript to defold to make it work.
We can write ‘controllers’ for smarthphones on Unity, so we dont really need ability to pass messages from defold to js right now


#5

The solution I can think of without involving the engine team is if the javascript communicates using a websocket to a localhost websocket server running inside Defold (and written in Lua). I’m not sure if it’s feasible, but it should work in theory at least…


#6

Haven’t used websockets on either js or lua before, but i should give it a try, thanks! Any hints on websockets in lua? Or any standart websockets library should work with defold in theory?


#7

Yes, js communication is really important feature.
Without this feature html5 build is too narrowly specialized.

Many people often ask me about this possibility in defold.
By popularity this question as question about native extension.


#8

Take a look at my DefNet project and specifically the section about websockets. It should hopefully give you some clues as to how to proceed. I will not have time to investigate this myself right now I’m afraid.


#9

I believe that JS communication will be worked on as soon as we have finished the work on native extensions and live update. I agree that it is an important feature.