In this task, you will create a new Flex project in Flex Builder that will use the FDS. You will also create a simple application and browse and compile that application.
Open Flex Builder 2 and be sure that FDS is running. From the menu, choose File > New > Flex Project. Select Flex Data Services. Also, select the Compile application on the server when the page is viewed radio button.
This will set up a project that uses the FDS and generate the SWF files on the server when the page is viewed instead of compiling the SWF files on the client. This offers many advantages for customization and personalization of applications. In addition, the FDS server has the capability to cache these SWF files for later use.
Click Next. Uncheck the Use default location for local Flex Data Services server check box and select the following location as the Flex context root you want to use for your Flex project:
The Flex development server location defaults to the integrated server's Flex context root. If you want to use a different context root, uncheck the default location option and make the appropriate changes.
Click Next, assign the project a name of TfsDataServices, and leave all the defaults.
This creates a new folder underneath the FDS context root with the name of TfsDataServices. A new MXML file that will serve as your application root is also created, again with the name of TfsDataServices. Of course, you can change all these names by unchecking the Use default location check box.
Click Finish, and note the [source path] user_classes folder as well as the html-template folder, and the flex-config.xml that have been created for you.
When you click Finish, you should see that your new project has been created and that the main application file is ready for editing. The [source path] user-classes folder that has been created for you is simply a link to the WEB-INF/flex/user_classes directory in the installation of the FDS. Any ActionScript classes that are placed in this directory are part of the application's classpath. The html-template file is a directory that contains the model for the HTML and Flash Player detection code that will be generated and sent to the browser. You can customize the HTML by making changes to the included index.template.html file. The flex-config.xml is a link to this file in the WEB-INF directory, in which you can modify configuration settings.
From the Flex Builder menu, choose File > New > File. Click the Advanced button to display more options and click the Link to file in the file system check box. Click Browse and navigate to the WEB-INF/flex directory under the Flex context root and select the file services-config.xml file. Enter the filename services-config.xml as an alias in the filename text box. Be sure not to include any directory information. Click Finish.
You should now see the linked file in the Navigator window. This will create a link to the external default FDS configuration file in Flex Builder that you can access. This is a file that you will access many times, and it is handy to have a link to it in Flex Builder. You could also use any text editor to modify this file as well but it will make it much easier for you if you can access it directly from Flex Builder.