我可以生成一个Flex Web和AIR桌面应用程序从同一来源$ C ​​$ C? [英] Can I generate a Flex web and Air desktop app from the same source code?

查看:147
本文介绍了我可以生成一个Flex Web和AIR桌面应用程序从同一来源$ C ​​$ C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的空气。我有一个现有的Flex 2应用程序,我正在考虑带进弹性生成3.我的问题是,我可以使用相同的基本应用程序(和源$ C ​​$ C),以使空气的版本,否则我将不得不保持到独立的code树:一个是空的版本,一个用于Flex的/ SWF版本

I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code trees: one for the Air version and one for the Flex/SWF version?

推荐答案

我发现创建来自同一来源的Flex和AIR应用程序的最佳方法,是使用一个核心库项目,几乎所有code与独立的小项目,为Flex和AIR应用程序。

The best approach I've found to creating both Flex and AIR applications from the same source, is to use a core library project for almost all code, with separate small projects for the Flex and AIR applications.

有,使这个非常强大的,可维护的两个重要概念,允许不只是两个应用程序,但是对于很多版本,如果你是这样的倾向。

There are two key concepts that make this very powerful and maintainable, allowing for not just two applications, but for many "editions" if you're so inclined.

  1. 模块: - 如果核心应用程序 实际上是一个模块(或一个模块, 装载其它模块),你就可以 轻松创建存根Flex和AIR 这是基本的应用 有设置项目属性, 跨模块的引用类 沟通,然后简单地加载 用核心应用模块 ModuleLoader组件。

  1. Modules:- If the core application is actually a module (or a module that loads other modules) you'll be able to easily create stub Flex and AIR applications that are basically there to set project properties, reference classes for cross-module communication, and then simply load the core application module with a ModuleLoader.

工厂对象: - 当有 你想要做的事情AIR 桌面应用程序,你不能 做的Flex应用程序,或任何 在那里你想要的东西的情况下 跨不同工作 应用程序,一个工厂对象 创建一个项目的一个实例 具体的类是一个伟大的方式做 它。例如,你可以打电话给你 保存功能,这对于空气节省 到文件系统,但针对Flex呼叫 Web服务。

Factory Objects:- When there are things you want to do on the AIR desktop application that you can't do in the Flex application, or any case where you want something to work differently across applications, a factory object that creates an instance of a project specific class is a great way to do it. for example, you can call your "save" function, which for AIR saves to the file system, but for Flex calls a web service.

看一看托德prekaski的 优秀的Flex的DevNet文章 构建Flex和Adobe AIR 从相同的code基应用 如何做到这一点。

Have a look at Todd Prekaski's excellent Flex DevNet article on Building Flex and Adobe AIR applications from the same code base on how to do this.

一旦你创建一个Flex库项目中,你要创建主模块,创建Flex和AIR应用项目。在这两个应用项目的属性添加库项目src目录下的Flex构建路径。而在项目设置你还需要将模块添加到Flex模块部分,设置以优化项目的选项。

Once you've created a Flex Library project where you're going to create your main module, create your Flex and AIR application projects. In the properties of the two application projects add the library project src directory to the Flex Build Path. While in the project settings you'll also need to add the modules to the Flex Modules section, setting the option to optimise for the project.

这篇关于我可以生成一个Flex Web和AIR桌面应用程序从同一来源$ C ​​$ C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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