Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
8 Your First inFormation-rich application A package is a way to organize source code. In Flex, apart from the default package above, each package corresponds to a path on the disk. Usually packages are structured like inverse URLs, for example, com. studiomagnolia. components . In the project folder (either in src or Lib) there will be a folder with the following path: com/ studiomagnolia/ components . We are a company and we would like to customize the template for all the projects created by our employees. Can we? Sure, just modify the files in {$flex_directory}/ Flex imports that directory to create the HTML- template folder. sdks/{$flex_version}/ templates/swfobject . Then we can specify the SDK to be used in the project. This is a choice we can also modify later. If we want to take advan- tage of the new features introduced in the last release of Flex, we choose Flex 4. Now we move to the next step. Here we keep the default value for the output folder and click Finish. As you can see from Figure 1.5, the Flash Builder has already created a bunch of folders for us. This is a pretty standard organization of folders, well known by Flex developers. The src folder contains MXML and ActionScript source files. It is important to note that the src folder does not exactly reflect the organization of the folders of your project. In fact, if you check out your workspace, there is no folder named DefaultPackage. You might also notice that Flex 4 is not present in the proj- ect folder. This item in the project is used to specify the library path. If you open the node, it will show the list of libraries (auto- matically linked) that are needed to run the Flex application (Figure 1.6). The folder Bin-debug is where the compiled application, the built-in debug mode, is stored. The Flex compiler does not sim- ply create an SWF file, but it outputs also its hosting HTML page already set up, which already embeds the Flex application. To do so, it uses the files in the HTML-template folder. If you know HTML and CSS (Cascading Style Sheets) you can customize the HTML page generated by Flex. Finally there is a Libfolder,wherewecanimport/storethird- party libraries needed to run our application. (a) (b) Figure 1.5 (a) project explorer and (b) its corresponding folder. Figure 1.6 libraries automatically imported by the project wizard.