Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.09 MB, 764 trang )
Figure 1-1. Creating a new Flex project
application will be connecting to a server, and if so, what server type and separate
configuration type are needed.
If you have nothing more to add, click Finish. To change the location where the compiled SWF file will be placed, click Next to reach the screen shown in Figure 1-3.
Once you’ve set the location for the generated SWF, you can either click Finish or add
source folders or SWC files to the project. To add another folder or set of folders, click
the Source Path tab (Figure 1-4). To add SWC files to the project, click the Library Path
tab (Figure 1-5). On this screen, you can also change the main MXML application file,
which by default has the same name as the project.
With all paths and names specified, click Finish. Your project is now configured, and
you are ready to begin development.
1.1 Create a Flex Project in Flash Builder | 3
www.it-ebooks.info
Figure 1-2. Creating a new project in Flash Builder
4 | Chapter 1: Flex and ActionScript Basics
www.it-ebooks.info
Figure 1-3. Setting the location where the compiled SWF will be placed
1.1 Create a Flex Project in Flash Builder | 5
www.it-ebooks.info
Figure 1-4. Setting the source folder and main application file
6 | Chapter 1: Flex and ActionScript Basics
www.it-ebooks.info
Figure 1-5. Setting any additional source paths for a Flex project
1.1 Create a Flex Project in Flash Builder | 7
www.it-ebooks.info
1.2 Create a Flex Library Project in Flash Builder
Problem
You need to create a Flex Library project.
Solution
From the Flex Navigator, choose New Flex Library Project to access the Create New
Project wizard.
Discussion
A Flex Library project does not have a main MXML file that is compiled into a SWF.
Instead, the project files are compiled into a SWC file that can be used in other applications or as the source for a runtime shared library (usually referred to as an RSL). The
classes within the library are used to create a group of assets that can be reused in
multiple projects at either compile time or runtime. To create a Flex Library project,
right-click or Ctrl-click (Mac) in the Flash Builder’s project navigator to open the contextual menu (Figure 1-6), or use the File menu. In either case, then choose New→Flex
Library Project.
Figure 1-6. Creating a Flex Library Project
8 | Chapter 1: Flex and ActionScript Basics
www.it-ebooks.info
Figure 1-7. Setting the project location and SDK for the compiler
In the resulting dialog box (Figure 1-7), specify a name for your project as well as its
location.
If you have nothing more to add, click Finish now. If you need to include files, assets,
or other SWC files, including the Adobe AIR libraries, click Next and select them from
the resulting screen. To set the path to assets or classes that you would like to add to
the library, first browse to a source path you would like to include and then specify the
classes or graphical assets to compile into the library. Click Finish to create the project.
1.3 Set Compiler Options in Flash Builder
Problem
You need to set specific compiler options for the MXML compiler.
1.3 Set Compiler Options in Flash Builder | 9
www.it-ebooks.info