c++ 和 actionscript 3 之间的通信

2021-12-17 00:00:00 c++ actionscript-3 flex4

是否可以使用任何 IPC 机制从 Adob??e Flash 动作脚本调用 c++ api?有什么好的例子吗?

Is it possible to use any IPC mechanism for calling a c++ api from Adobe Flash actionscript? Are there any good examples?

更新:我现在主要希望它用于桌面应用程序,即 Adob??e 的/或任何其他人的桌面运行时

Update: I primarily want it for desktop apps now i.e Adobe's/or anyuone else's desktop runtimes

推荐答案

不是来自 Flash Player,因为它很可能会违反其安全模型.您可以从 Tamarin VM 调用 C++,例如 mod-actionscript 正在执行.一种选择是将您的调用传递到 AS3 服务器,在那里调用一些 C++ 函数并将结果发回.另一种选择是使用 alchemy 将 C++ 代码交叉编译到 AVM2.但是,如果您想调用 C++ 来访问客户端计算机上 Flash Player 无法提供的功能(文件系统访问、UDP 或其他),那就没有办法了.

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 打包并仅使用 AS3 解决
  • 创建一个后台运行的C++守护进程,可以和flash through进行双向通信
    • 具有自定义协议的本地套接字(您将在守护进程中绑定一个端口,Flash 客户端将连接到它)
    • 一个LocalConnection.从 AS3 的角度来看,这看起来好一点,但需要在 C++ 方面进行一些黑客攻击,因为您需要掌握连接并实现协议(指针 这里)
    • have a look at the flash.accessibility package and solve it with AS3 only
    • create a C++ daemon running in the background, which can have bidirectional communication with flash through
      • a local socket (you'd bind a port in the daemon and the flash client would connect to it) with a custom protocol
      • a LocalConnection. 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)

相关文章