How to Create a Lib(.swc) File ?

The .swc file is the component compilation of the components.With this file included in the other projects of the lib folder [using Flex Builder IDE] we can use those compiled components.After include it in the lib foler of the project ,the components are added to the Custom folder in the Components view.
To do this we need to create a Library Project in Flex Builder, and create components there with our properties and functionality and the relating .swc file is created in the bin folder in that project which is the compilation of the components we define in the Library Project,we can define and create as many components in the Lib Project and the corresponding .swc file is updated i.e the compilation of the components are written in it.

So, when your are done with defining the components in Lib Project add the .swc file in the lib folder of the required Flex Project where you would like to use this custom components.

Now drag the CustomComponents from the Custom folder in the components view on the design view and the required functionality is written in them and we can add other funtionality.

This is with the Flex Builder, if not using the Builder then define the components in a folder and compile the components in that folder it will generate the .swc file.

For compilation use the command promt with the commands like

mxmlc filename.mxml

Happy Flexing..

9 Responses to “How to Create a Lib(.swc) File ?”

  1. Nargis Says:

    This is very difficult to get stuff
    can u describe it in simpler manner?

    • kumargandhi Says:

      Hi,
      If you are using the Flex Builder then do the following,
      Create a New->Flex Library Project, then in the project create a component like in the ordinary project , like i create a new Button Component and set the label to Kumar.Then the related Component compilation file(.swc) is generated in the bin folder of the library project.Now by using this .swc we can include those component in the Flex Project by adding it to the lib folder of the Flex Project.
      Now if you are not using the Flex Builder, then we got to set the path to the flex compiler in the sdk’s to the command prompt and compile our components from there.And it generates the Component compilation file(.swc) and rest is similar to that of the above.

      I hope now its clear, :-) ,

      regards,
      kumar.

  2. caxton Says:

    Hi kumar:

    Do you know how to recompile SWC for flexlib(http://code.google.com/p/flexlib/)?

    I don’t know what compoment should be created after a new libary project has been generated.

    The main reason to recompile the swc is that I want to dispatch event to its schedule entry, but some methods are private so that I can not override.

    Thanks.

    • kumargandhi Says:

      Hi,

      We need to have the component set to recompile, like here i need to have the flexlib component’s set code to recompile and generate a freash SWC for that set.Here SWC is itself a compiled file, so you cannot compile a compiled file.

      regards,
      kumar.

  3. Ragunth Says:

    Hi,

    I want to remove some components from already existing swc. How to recreate the same swc with modified items. Please help me.

    Thanks in advance,
    ragu

  4. vishnu Says:

    how to edit my swc file?

  5. vishnu Says:

    Hai, thanks for your reply!!!!!!!!

    How can i bring a column chart on same page by clicking the existing column chart items???

Leave a Reply