Flash Builder - How to create or enable SWC

I am trying to recreate an updated version of this tutorial here, but I am having trouble creating and linking to a SWC file to include in my Flash Builder project. Whenever I try to reference the SWC, Flash says it is "not a compile-time constant" - can anyone help me with the process of creating the SWC (basically by naming it so that Flash Builder can reference it), and then in Flash Builder creating this link to SWC? Thanks to

+2


source to share


5 answers


You can create swc from Flash Builder by creating a library project as Emanuel already answered. Usually all classes that are in the source path of a library project end up in swc, and then these classes can be used in another project that has swc in its library path.

Another way to create swc is using Flash, publishing not only swf, but also swc (this is a checkbox in the publishing settings). Then, all library items that have the Export for ActionScript check box and a class name go to swc for use in another project.

You are referencing classes from swc just like you are referencing a class in your own original 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 it helps ...

+3


source


To add swc to Flash Builder, follow these steps:



Adding a swc to Flash Builder

+4


source


To create a SWC file, you need to create a library project. For detailed instructions, see the About library projects article in the Flash Builder documentation.

To use a SWC file in a Flex project, simply copy it to libs

that project folder .

+2


source


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

+1


source


Use a Flex library project to create a SWC as above. There are many ways to include external code in your project.

_ Copy to libs folder as the default build path included this folder.

_ Project Properties> Action script Build Path> Add SWC to add a SWC file that can be found anywhere in your file system.

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

0


source







All Articles