C ++和ActionScript 3之间的通信 [英] Communication between c++ and actionscript 3

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

问题描述

是否有可能使用任何IPC机制调用从的Adobe Flash ActionScript中的C ++ API?是否有良好的例子?

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

更新:我主要是想为桌面应用程序现在即Adobe的/或anyuone其他人的桌面上运行时

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

推荐答案

不是从flash播放器,因为这很可能违反了安全模型。您可以从Tamarin的虚拟机,这对于例如 MOD-动作调用C ++是在做。一种选择是将您的呼叫传递到AS3服务器,调用一些C ++函数那里发回的结果。另一种选择是交叉编译的C ++ code。使用炼丹以AVM2。但是,如果你要调用C ++来在客户机上访问功能不可用的flash播放器(文件系统访问,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:

  • 有一个看<一href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/accessibility/package-detail.html"相对=nofollow> flash.accessibility 包和AS3只有
  • 解决问题
  • 创建一个C ++守护进程在后台运行,可以通过在具有快速的双向通信
    • 本地套接字(你绑定端口的守护程序和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之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆