Friday, May 14, 2010

Creating library project in flex

Creating library project:
  • Open Flex builder 3
  • Navigate to File->New->Flex Library Project
  • In the New Flex Library Project dialog
  1. Enter the project name as "FirstLibProject"
  2. Click on Next
  3. Select the Classes tab
  4. In the Main source folder item click on Browse
  5. In select Source folder dialog select the project
  6. Click on New button
  7. A new folder will be added under the projects
  8. Click Ok
  9. Select the checkbox for the src folder (All the classes in this folder will be included in library swc)
  10. Click on Finish button
  • Create an mxml component under src folder by right clicking on src folder and name it "LibrarySample.mxml"
  • Create an Action script class under src and name it as "LibraryAS.as"
  • In the bin folder a swc file will be created by name FirstLibProject.swc

In our mxml if we want to use these Files which we created above we can include the swc file to our project.


Including the swc file in a project:
In the project "Xyz" which we want to include the swc copy the swc which we created above:

  • Copy the FirstLibProject.swc to some path (c:\lib)
  • Open the project "Xyz" in Flex builder
  • Right click on the project "Xyz" (in navigator view) click on Properties
  • Select Flex Build Path in the Properties dialog
  • Select Library path tab
  • Click on Add SWC and browse for C:\temp\FirstLibProject.swc and click Ok
  • In this project we can use the classes LibrarySample and LibraryAS

1 comment:

Unknown said...

I certainly agree to some points that you have discussed on this post. I appreciate that you have shared some reliable tips on this review.

Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory