Flex:在多个项目中重用类而无需复制和粘贴?
好的,我在网上制作或找到了一些类,我计划在多个项目中使用它们,我宁愿将这些类存储在一个中心位置,而不是将它们复制+粘贴到每个项目中。
我的 Flex 项目在路径 Flex/WorkSpaces/< 中有自己的工作区 工作空间名称>
如果我想在 Flex 目录中放置另一个文件夹并将包设置为 com.mydomain.whatever
我需要创建什么文件夹结构,以及如何使我的项目可以访问代码?
谢谢!
OK I have a few classes I have made or found on the web that I plan to use in multiple projects, I would rather store these classes in a central location instead of copy+pasting them into each project.
my Flex projects have their own workspaces inside the path Flex/WorkSpaces/< workSpaceName >
If I wanted to put another folder inside the Flex directory and have the packages be com.mydomain.whatever
What folder structure would I need to make, and how would I make the code accessible to my projects?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在 FB3 中导入整个项目。 请查看文档。
使用包总是更好。 保持 src 的组织如下:
You can import entire projects in FB3. Take a look at the documentation.
It is always better to use packages. Keep the src organized as follows:
进入项目属性,选择构建路径。 在源路径选项卡中,您可以添加包含文件系统上任何位置的 ActionScript 文件的文件夹。 在库路径选项卡中,您可以添加单个 SWC 或包含多个 SWC 的文件夹。
一个示例(适用于 Windows,但在 Mac 上应该类似):
假设您有一个文件夹
C:/Development/classes
,其中保存了跨项目重复使用的所有“共享”源文件。 在该文件夹中,您想要保留您的一个类,com.example.MyClass
。 您应该使用以下文件夹结构:C:/Development/classes/com/example/MyClass.as
Go into the Project Properties, Choose Build Path. In the Source Path tab, you can add folders containing ActionScript files from anywhere on the file system. In the Library Path tab you can add individual SWCs or folders containing multiple SWCs.
An example (for Windows, but it should be similar on a Mac):
Let's say you have a folder
C:/Development/classes
where you keep all the "shared" source files that you reuse across projects. In that folder, you want to keep one of your classes,com.example.MyClass
. You should use this folder structure:C:/Development/classes/com/example/MyClass.as
我通常会做的是创建一个新的库项目并将这些类存储在该项目中。
要将库项目链接到当前项目,您只需将其添加到当前项目的库路径(项目属性 -> Flex/ActionScript 构建路径 -> 库路径选项卡)。
What I would normally do is create a new library project and store those classes in that project.
To link that library project to your current project you would only have to add it to the library path of the current project (Project Properties -> Flex/ActionScript Build Path -> Library Path tab).