我可以将 AS3 代码或 Flex 项目交叉编译为本机 C++ 吗?

发布于 2024-12-09 00:36:05 字数 85 浏览 1 评论 0原文

我想采用现有的 AS3 或 Flex 项目并将其编译为在本机 C++ 代码上运行。有办法做到这一点吗?存在哪些类型的解决方案?我不想更改我的 AS3 代码。

I would like to tak emy existing AS3 or Flex project and compile it to run on native C++ code. Is there a way to do this? What sort of solutions exist? I do not want to change my AS3 code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

美人如玉 2024-12-16 00:36:05

AS3 是一个在预构建库上运行的框架,您必须在“翻译”代码中以某种方式进行替换。例如,当您执行 new Sprite() 时,您会想象本机代码会做什么?

Haxe 并没有试图寻找替代者。它采用不同的方法,因为它允许您重用可以轻松翻译的代码位,但那些不能翻译的代码被标记为特定于特定环境。然而,Haxe 正在努力通过使用 NME 图形引擎来提供类似于 Flash 显示列表的 API。

给出您使用 iOS 编译器的示例 - 它再次针对现有的本机代码库进行编译,该库提供显示列表、视频和音频播放器等功能。

AS3 is a framework operating on prebuilt libraries you would have to replace somehow in your "translated" code. For example, what would you imagine the native code to do, when you do new Sprite()?

Haxe doesn't try to find a replacement. It takes different approach in that it lets you reuse bits of the code that would translate easily, but those that don't translate are marked as specific to certain environment. There is, however, an effort in Haxe to come up with API similar to those of Flash display list by using NME graphic engine.

Given your example with the iOS compiler - it, again, compiles against the existing library of native code that provides the functionality of display list, video and audio players and so on.

我很坚强 2024-12-16 00:36:05

如果您可以将其转换为 Haxe(Haxe 的语法与 AS3 极其相似,只有库和某些语言结构不同),它应该为您提供“本机”编译的选项。我听说它甚至提供了 C++ 源代码,或者是 IRC Haxe 房间的人告诉我的。我可能会因为代码部分而被恶搞,尽管他看起来并不像是在恶搞……

我并不完美,而且肯定缺乏一些更高级的功能,但它可能值得一看。

If you can convert it to Haxe (Haxe has extremely AS3 like syntax, only libraries and some language constructs differ) it should provide you with an option of compiling for "native". I've heard it even provides a C++ sourcecode or so I've been told by folks at IRC Haxe room. I could have been trolled for the code part, though he didn't seem like he was trolling...

I'ts not perfect and definitely lacks some more advanced capabilities but it's worth looking at probably.

烟沫凡尘 2024-12-16 00:36:05

不,因为

  • C++ 中缺乏动态功能(那里没有等效的 ObjectdescribeType),
  • C++ 中缺乏 Flash 本机类型(String (std::string不等价)、显示对象和许多其他)
  • 缺乏语言功能(事件侦听器、垃圾收集)
  • 缺乏 C++ 中的 Flex 框架等效项(C++ 中还有其他好的 GUI 框架,但没有一个看起来像 Flex - 由于上述原因。)

简而言之,在 C++ 中(使用 Qt 或任何具有相当强度的框架)编写类似的程序比编写转换器要容易得多。

No, because of

  • absense of dynamic features in C++ (you don't have Object and describeType equivalent there)
  • absense of Flash native types in C++ (String (std::string is not equivalent), display objects and many others)
  • absense of language features (event listeners, garbage collection)
  • absense of Flex framework equivalent in C++ (there are other good GUI frameworks in C++, but none looks like Flex - because of the reasons above.)

In short, it's much easier to write similar program in C++ (using Qt or whatever framework of comparable strength) than write convertor for that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文