本文介绍了c++ 和 actionscript 3 之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用任何 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)

      这篇关于c++ 和 actionscript 3 之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 01:27