問題描述
是否可以使用任何 IPC 機制從 Adob??e Flash 動作腳本調(diào)用 c++ api?有什么好的例子嗎?
Is it possible to use any IPC mechanism for calling a c++ api from Adobe Flash actionscript? Are there any good examples?
更新:我現(xiàn)在主要希望它用于桌面應(yīng)用程序,即 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 調(diào)用 C++,例如 mod-actionscript 正在執(zhí)行.一種選擇是將您的調(diào)用傳遞到 AS3 服務(wù)器,在那里調(diào)用一些 C++ 函數(shù)并將結(jié)果發(fā)回.另一種選擇是使用 alchemy 將 C++ 代碼交叉編譯到 AVM2.但是,如果您想調(diào)用 C++ 來訪問客戶端計算機上 Flash Player 無法提供的功能(文件系統(tǒng)訪問、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 解決 - 創(chuàng)建一個后臺運行的C++守護(hù)進(jìn)程,可以和flash through進(jìn)行雙向通信
- 具有自定義協(xié)議的本地套接字(您將在守護(hù)進(jìn)程中綁定一個端口,F(xiàn)lash 客戶端將連接到它)
- 一個
LocalConnection
.從 AS3 的角度來看,這看起來好一點,但需要在 C++ 方面進(jìn)行一些黑客攻擊,因為您需要掌握連接并實現(xiàn)協(xié)議(指針 這里)
- 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)
這篇關(guān)于c++ 和 actionscript 3 之間的通信的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!