简体   繁体   English

在桌面上运行 Flex 移动应用程序

[英]Run Flex Mobile Application on Desktop

I have a completed Flex Mobile application, built for the Blackberry Playbook.我有一个完整的 Flex Mobile 应用程序,专为 Blackberry Playbook 构建。 I would like to have it so the application could run on the desktop.我想拥有它,以便应用程序可以在桌面上运行。 I don't mean in the simulator, I mean as an actual application on Windows.我不是说在模拟器中,我的意思是作为 Windows 上的实际应用程序。

Is this possible/easy to do?这可能/容易做到吗? How could this be done?怎么可能做到这一点?

If you want an installable desktop app of your mobile project in Flash Builder you can:如果您想要在 Flash Builder 中安装您的移动项目的桌面应用程序,您可以:

  1. Click on Project > Export Release Build.单击项目 > 导出发布版本。
  2. Fill in your destination directory in the "Export to folder" input.在“导出到文件夹”输入中填写您的目标目录。
  3. Change the "Export as" option to "Signed AIR package for installation on the desktop" and click the Next button.将“导出为”选项更改为“签名的 AIR package 以在桌面上安装”,然后单击“下一步”按钮。
  4. You'll need to have or create a new digital signature.您需要拥有或创建新的数字签名。 Click the Create button and fill out the form to have Flash Builder create it for you.单击创建按钮并填写表格,让 Flash Builder 为您创建它。
  5. Then hit Finish and it'll build an AIR app that you can install on the desktop OS.然后点击完成,它将构建一个 AIR 应用程序,您可以将其安装在桌面操作系统上。

I'd suggest setting some values in your APPNAME -app.xml file in your project.我建议在项目的APPNAME -app.xml 文件中设置一些值。 I set resizable to false, width to 640 and height to 960 so that it would mimic a mobile iPhone 4 app.我将resizable设置为 false,将宽度设置为 640,将高度设置为 960,这样它就可以模仿移动 iPhone 4 应用程序。 I also made sure my application identifier ( id ) was set, along with filename , versionNumber and versionLabel .我还确保设置了我的应用程序标识符 ( id ) 以及filenameversionNumberversionLabel

If you'd like to put your app on your website, Michaël Chaize has a great post on how to run a version of your Flex app in the browser .如果您想将您的应用程序放在您的网站上,Michaël Chaize 有一篇关于如何在浏览器中运行您的 Flex 应用程序版本的精彩文章。 Basically you create a new non-mobile project, add the mobile components, override some classes for states and orientation changes you'd have on a device, and include the mobile skin and you're finished.基本上,您创建一个新的非移动项目,添加移动组件,覆盖您在设备上的状态和方向更改的一些类,并包含移动皮肤,您就完成了。 I have not tried this yet, and I don't know if there are any caveats or restrictions with this route.我还没有尝试过,我不知道这条路线是否有任何警告或限制。

Generally, with Flex Builder I would create a new project, with the same code.通常,使用 Flex Builder,我会使用相同的代码创建一个新项目。 Or, ideally, move the shared code into a library project;或者,理想情况下,将共享代码移动到库项目中; then you can easily share it between the two projects.然后您可以轻松地在两个项目之间共享它。

If you're using a build tool, such as ANT or Maven, you should be able to use the SDK w/ different compiler flags to create your release builds from the exact same source base.如果您使用的是构建工具,例如 ANT 或 Maven,您应该能够使用 SDK w/不同的编译器标志来创建您的发布版本。

Of course, in most cases you won't want to use the same exact code in a mobile app that you use in a desktop app.当然,在大多数情况下,您不希望在移动应用程序中使用与在桌面应用程序中使用的完全相同的代码。

Change the publish settings to AIR for desktop.将发布设置更改为 AIR for desktop。 You'll probably get errors if you have accessed any APIs that are explicitly reserved for that mobile platform but that will require some refactoring on your part and is unavoidable.如果您访问了为该移动平台明确保留的任何 API,那么您可能会遇到错误,但这需要您进行一些重构并且是不可避免的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM