FusionCharts for Flex > Special Cases > Using Flex SDK

Flex is a productive, free open source framework for building and maintaining Flash interface applications. Flex can be implmented using Adobe Flex Builder or the open source Flex SDK. If you do not want to invest in the Adobe Flex Builder, FusionCharts can still be integrated with your Flex applications by using the free SDK. After writing the MXML file with FusionCharts code in it, a simple mxmlc command will allow you to create your SWF file with FusionCharts objects within it.

We have integrated FusionCharts with the Flex development environment as an external library module. For this example case we will assume that the folder libs and src are present within the project root and that the MXML file is present at the src folder . All subsequent instructions assume that this directory structure is present. We will also assume that you have installed the Flex SDK and the path to the mxmlc compiler is specified in you operating system's PATH variable.

Compiling a Simple Project

To compile an application with Flex SDK, you use the mxmlc compiler in the bin directory of your Flex SDK directory. The most basic mxmlc example is one in which the MXML file for your application has no external dependencies (such as components in a SWC file or ActionScript classes). In this case, you open the command line and change the present working directory to your project root (referenced as PROJECT_ROOT from here on) . After this, you the open mxmlc from the command line and point it to your MXML file (we have assumed the file name as FusionCharts.mxml), as the following example shows

mxmlc src\FusionCharts.mxml

Importing FusionCharts Files to your Project

In order to use FusionCharts with the Flex SDK, you must import the libraries to your project.

  1. Copy the FusionCharts.swc ShockWave Component from DISTRIBUTION_ROOT/Charts to PROJECT_ROOT/libs folder. The DISTRIBUTION_ROOT root is the location where you have downloaded and extracted the FusionCharts for Flex archive.
  2. Copy the fusioncharts folder from DISTRIBUTION_ROOT/Charts to the PROJECT_ROOT/src folder. This folder holds all the chart Flash objects.
  3. Create your MXML file at PROJECT_ROOT.

Writing FusionCharts Code

Now you should add all necessary code to implement FusionCharts. In most of the pages of previous sections we have discussed numerous code samples. To look at our basic examples, you can visit the Your First Chart section.

Compiling your Application using FusionCharts SWC

Now that you have imported the necessary library files and updated the MXML file with FusionCharts code, you are all set to incorporate FusionCharts into your applications. The following command re-compiles the files using the FusionCharts SWC library.

mxmlc -library-path+=lib\fusioncharts.swc src\FusionCharts.mxml 

The library flag is used to declare one or more libraries. In our case, the library is fusioncharts.swc. After the command is executed, it generates the necessary SWF file with your FusionCharts component.