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?
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.
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
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…
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?
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.
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.