本文介绍了什么是分发AS3类和包的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小框架,我想提出在那里。我喜欢这些类导出为单个文件。

我知道有一个深港西部通道的格式,但没有就如何导出建立这么多新的信息,我有一种感觉,这种格式可能会过时。

解决方案

一个的只是一个ZIP文件(改名为扩展名),其中,最低包含一个SWF影片(编译后的字节code为您的图书馆)和一个XML文件,该文件提供了提示关于SWF的内容。但是,作为一个SWC文件只是一个ZIP文件,您可以添加更多的信息;最常见的是包括的ASDoc输出这然后可以通过集成开发环境(如Flash Builder 4中)被解析并显示为在线文档。

SWC文件是由开发pferred,因为它们是自包含的构建依赖$ P $。这使它们易于管理,你只需要落单SWC文件到项目中得到它的编译。他们也preferred,因为他们阻止初级开发人员试图进行任何修改的库源$ C ​​$ C(此时它不再是一个第三方库)。

SWC文件可以使用Adobe compc命令程序进行编译;大多数Flash IDE的( Flash Builder中,的和的)从GUI的SWC支持汇编;但你也可以编译通过命令行, ANT 的SWC ,或 Maven的

有一点需要注意的创建框架的SWC文件时,对于是外化的任何编译依赖你的项目了。例如,让我们假设你的框架使用了 GreenSock图书馆的;而不是编译你的整个框架,包括GreenSock code到一个单一的SWC文件,你应该将编译SWC,excluding所有code包含在你的项目的依赖(即:greensock.swc),然后同时分配你的图书馆的SWC文件和greensock.swc文件 - 这样一来,开发者利用你的框架荣获 T为强制使用GreenSock库,你对编译的版本。这种做法在行动的一个例子可以在的Robotlegs框架这两种分配和robotlegs.swc中找到swiftsuspenders.swc。

我已经写了一篇博客文章管理构建依赖可以提供相关的阅读的话题。

最后,我会建议举办一个公开的SCM解决方案的库源$ C ​​$ C;例如在 GitHub的或的,这样开发人员可以读取(结账)源$ C ​​$ C,如果他们需要一个参考 - 它也提供了一个良好的中央位置,问题管理和文档。

I have a small framework that I would like to put out there. I would love to export these classes as a single file.

I know there is a SWC format, but there is not much recent information on how to export build this and I have a feeling this format might be outdated.

解决方案

A SWC file is just a ZIP file (with the extension renamed) which, at minimum contains a single SWF movie (the compiled bytecode for your library) and an XML file which provides hinting about the contents of the SWF. However, as a SWC file is just a ZIP file you can add additional information; the most common being including ASDoc output which can then be parsed by IDEs (such as Flash Builder 4) and displayed as in-line documentation.

SWC files are preferred by developers because they are self-contained build dependencies. This makes them easy to manage as you only need to drop a single SWC file into a project to get it to compile. They are also preferred because they discourage junior developers from attempting to make any modifications to the libraries source code (at which point it stops being a 3rd party library).

SWC files can be compiled using the Adobe COMPC utility; most Flash IDE's (Flash Builder, FDT, and FlashDevelop) support compilation of SWCs from the GUI; but you can also compile SWCs from the Command Line, ANT, or Maven.

One thing to watch out for when creating your Framework's SWC file is to externalise any build dependencies that your project has. For example, let's assume that your Framework makes use of the GreenSock Library; instead of compiling your entire framework, including the GreenSock code into a single SWC file, you should instead compile your SWC, excluding all the code contained in your project's dependencies (ie: greensock.swc) and then distribute both your libraries' SWC file and the greensock.swc file - this way, developers that make use of your Framework won't be forced to use the version of the GreenSock Library you compiled against. An example of this practice in action can be found in the RobotLegs framework which distributes both robotlegs.swc and swiftsuspenders.swc.

I've written a blog post about managing build dependencies which may provide related reading on the topic.

Finally, I would reccomend hosting your Libraries source code on a public SCM solution; such at GitHub or Google Code, that way developers can read (and checkout) the source code if they require a reference - it also provides a good central location for issue management and documentation.

这篇关于什么是分发AS3类和包的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 05:20