Flash Builder - How to build or include an SWC

大城市里の小女人 提交于 2019-12-01 08:33:34

问题


I'm trying to recreate a modernized version of this tutorial here - but I'm having problems building and referencing a SWC file for inclusion in my Flash Builder project. Whenever I try to reference the SWC, Flash says it's "not a compile time constant" - can anyone help me with the process of building a SWC (mainly, naming it so that Flash Builder can reference it) - and then, in Flash Builder, creating that reference to the SWC? Thanks


回答1:


You can build a swc from Flash Builder by creating a Library project as Emanuil also answered already. Normally, all classes that are in the source path of the library project will end up in the swc and those classes are then usable in another project that has the swc in its library path.

Another way of creating a swc is by using Flash, publishing not only to a swf but to a swc too (it's a checkbox in publish settings). Then all library items that have "Export for ActionScript" checked and a class name, will end up in the swc for use in another project.

You reference classes from the swc exactly the same as you would reference a class in your own source path:

// this should be the package and class name of the class you need: 
//   not the name of the swc it comes from!
import some.package.name.ClassFromSWC; 

...

new ClassFromSWC();

Hope this helps...




回答2:


To add a swc to Flash Builder, follow these steps:




回答3:


To build a SWC file you need to create a Library Project. You can find detailed instructions in the "About library projects" article in the Flash Builder documentation.

To use a SWC file in a Flex Project, just copy it into the libs folder of that project.




回答4:


I don't know for Flash Builder, but in Flash Develop, you just have to right click on the swc file you want in the project files list panel, and click on "add to library".




回答5:


Use Flex Library Project to create SWC like the comment above. There are many ways to include external code to your project.

_ Copy to libs folder since default build path included that folder.

_ Project Properties > Action script Build Path > Add SWC to add an SWC file which could locate anywhere in your file system.

_ Project Properties > Action script Build Path > Add Project to include your Flex Library Project, in case the project is under development, so that you don't need to export SWC file and copy it into your application project every time the library changes.



来源:https://stackoverflow.com/questions/6333506/flash-builder-how-to-build-or-include-an-swc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!