Is it possible to use any IPC mechanism for calling a c++ api from Adobe Flash actionscript? Are there any good examples?
Update: I primarily want it for desktop apps now i.e Adobe's/or anyuone else's desktop runtimes
It is not possible from the browser-player. From an AIR application, you can use Socket API to do IPC.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/Socket.html?allClasses=1
If you target the Adobe AIR runtime, you can leverage the NativeProcess API that was introduced in AIR 2.0. This API allows you to spawn external processes and communicate with them via stdin and stdout.
If you're feeling adventurous and want to do something undocumented and completely unsupported, you can tap into the LocalConnection internals by interacting with the memory mapped file of the Flash Player. There's more detail on the osflash.org/localconnection site. This approach has some limitations and isn't supported. I don't recommend it.
As mentioned in some other answers, you can also use a socket connection to send/receive data.
Not from the flash player, as it would very likely violate its security model. You can call C++ from the Tamarin VM, which for example mod-actionscript is doing. An option would be to pass your calls to an AS3-server, call some C++ functions there and send back the result. Another option is to cross-compile the C++ code to AVM2 using alchemy. But if you want to call C++ to access features on the client machine not available from the flash player (file system access, UDP or whatever), then there's no way.
edit:
Ok, I suppose there are the following options:
flash.accessibility
package and solve it with AS3 onlyLocalConnection
. This looks a little better from the AS3 perspective, but requires a little hacking on the C++ side, since you need to get hold of the connection and implement the protocol (pointers here)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With