Before setting the compiler options in flash builder, we should know why we are setting the compiler options ? and then how ? That we can discuss in detail:
If you are a beginner then you can go through my previous posts for getting some basics:
Introduction to Adobe Flex and Flash Builder | Adobe Flex Tutorial #1
Creating Flex project in Flash Builder | Adobe Flex Tutorial #2
Why we want to set compiler options?
The MXML compiler called mxmlc, is an application that compiles Action script and MXML files into an SWF file that can be viewed in the flash player. When you run or debug an application in the flash builder, the MXML compiler is invoked and the files are passed to the compiler as an argument to the application. When you debug the application, an argument to create a debug SWF is passed to the MXML compiler. Flash builder lets you pass other arguments to the compiler,as well;
for example, you can pass arguments to specify the location of an external library path, allow the SWF to access local files, or set the color of the background.
How we can set the Compiler options?
For setting the compiler options in flash builder follow the given procedure,
To change the compiler settings for a project, right click on the project and select project properties from the contextual menu or choose project properties from the menu bar
In the resulting project properties dialogue box select Flex compiler .Here you have several options to control how the SWF file is compiled. IN the input field labeled Additional Compiler Arguments ,you can add multiple options; simply type a hyphen (-) in front of each option and separate the options with spaces.
Some of the most commonly used options for setting the compiler options in flash builder are as follows:
- verbose-stacktraces
Specifies whether the SWF will include line numbers and file names when a run time error occurs. This makes the general SWF larger.
Note that a SWF with verbose-stacktraces enabled is not the same as a debug SWF.
- source-path path element
Specifies directories or files to be added to the source path that contain MXML or Action script you want included.You can use += to append the new argument to the default options or any options set in a configuration file.
for example:
source-path+=/users/base/project
- include-libraries
Specifies a SWC file to be compiled into the application and links all the classes and assets in the library into the SWF. This option is useful if the application will load in other modules that may need access to the classes in a SWC that the SWF will not be using.
- library-path
Similar to the include-libraries option but includes only classes and assets that are used in the SWF. This lets you keep the size of the SWF file manageable.
- locale
Specifies a locale to be associated with a SWF file.
For example : you can use -locale=es_ES to specify that the SWF is localized for spanish.
- use-network
Indicates whether the SWF will have access to the local filesystem and is intended for use on a local machine,or whether the standard flash player security will apply.
For example: use -use-network=false to specify that the SWF will have local file-system access but will not be able to use any network services.The default value is true.
- frames.frame
Enables you to add asset factories that stream in after the application and then publish their interfaces with the ModuleManager class.The advantage of doing this is that the application starts faster than it would have if the assets had been included in the code, but it does not require moving the assets to a external SWF file.
- Keep-all-type-selectors
Ensures that all style information, even if it is not used in the application, is compiled into the SWF. This is important if the application will be loading other components that require style information. The default value is false, which means that style information not used in the application is not compiled into the SWF.
These are the different options available for setting the compiler options in Flash Builder.
After setting the options for the compiler, click the Apply button to save the options for that project.
1 comment
[…] http://technobytz.com/setting-compiler-options-in-flash-builder.html […]