[转]Using a custom flex-config.xml file in Flex Builder 3
2009-12-16 10:00
543 查看
The following example shows how you can use a custom configuration file in a Flex Builder Flex project by specifying an additional compiler argument,
Full code after the jump.
View MXML
Next, create a custom configuration XML file named fontConfig.xml and save it in a /config/ subdirectory in your project’s /src/ directory. The folder structure isn’t important, but it helps keep the source code and configuration files separated. The fontConfig.xml file is a modified version of the flex-config.xml file found in the Flex SDK’s /frameworks/ directory. In this example we simply specify a single named font range which specifies a unicode range of U+0020 (space) to U+007E (~).
config/fontConfig.xml
Finally, in Flex Builder, right click on the Flex Project folder in the Flex Navigator and select Properties from the context menu. Select the Flex Compiler section of the dialog menu and in the Additional compiler arguments: text box add the following text:
-load-config+=config/fontConfig.xml
Figure 1. Additional compiler arguments.
View source is enabled in the following example.
-load-config.
Full code after the jump.
View MXML
<?xml version="1.0" encoding="utf-8"?><!-- http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/ --><mx:Application name="LoadConfig_fonts_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"> <mx:Style> @font-face { src: url("assets/ARIAL.TTF"); fontFamily: "ArialEmbedded"; unicodeRange: "englishRange"; } Text { fontFamily: "ArialEmbedded"; fontSize: 32; color: red; } </mx:Style> <mx:ApplicationControlBar dock="true"> <mx:Form styleName="plain"> <mx:FormItem label="alpha:"> <mx:HSlider id="slider" minimum="0.0" maximum="1.0" value="1.0" snapInterval="0.05" tickInterval="0.1" liveDragging="true" /> </mx:FormItem> </mx:Form> </mx:ApplicationControlBar> <mx:Text id="txt" width="300" alpha="{slider.value}"> <mx:text>The quick brown fox jumps over the lazy dog. 1234567890 ©</mx:text> </mx:Text></mx:Application>
Next, create a custom configuration XML file named fontConfig.xml and save it in a /config/ subdirectory in your project’s /src/ directory. The folder structure isn’t important, but it helps keep the source code and configuration files separated. The fontConfig.xml file is a modified version of the flex-config.xml file found in the Flex SDK’s /frameworks/ directory. In this example we simply specify a single named font range which specifies a unicode range of U+0020 (space) to U+007E (~).
config/fontConfig.xml
<?xml version="1.0"?><flex-config> <compiler> <fonts> <!-- Defines ranges that can be used across multiple font-face declarations. --> <!-- See flash-unicode-table.xml for more examples. --> <languages> <language-range> <lang>englishRange</lang> <range>U+0020-U+007E</range> </language-range> </languages> </fonts> </compiler></flex-config>
Finally, in Flex Builder, right click on the Flex Project folder in the Flex Navigator and select Properties from the context menu. Select the Flex Compiler section of the dialog menu and in the Additional compiler arguments: text box add the following text:
-load-config+=config/fontConfig.xml
Figure 1. Additional compiler arguments.
View source is enabled in the following example.
相关文章推荐
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API
- Downloading files in Flex using the FileReference class
- Uploading files in Flex using the FileReference class
- Creating a XML Document from scratch without using a file in C#
- Create multiple endpoints using config file in WCF
- Using an XML data provider with the Spark List control in Flex 4
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API
- How to create an XTR file from XML in Delphi XE4 using XML Mapper?(delphi中如何通过xmlmapper创建xtr文件)
- vs, vsto,custom settings file in app.config 部署后会在哪里
- How to Modify the web.config file in SharePoint using SPWebConfigModification?
- Step By Step guide to Read XML file in Java Using SAX Parser Example
- How To Generate An XML File As A Target Datastore Using ODI In An Integration Interface ? [ID 454268
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API
- vs, vsto,custom settings file in app.config 部署后会在哪里
- Unknown class XSearchController in Interface Builder file.向CUstom class 中添加类 XsearchController时提示
- Using DocumentFormat.OpenXml to generate a new excel file in terms of temp excel file
- 转:Manage Web.config from XML File by using configSource attribute ASP.Net 2.0
- Configuring ${DOCUMENTS} variable in Flash (Flex) Builder
- sftpd 启动 报错: vsftpd:500 OOPS: bad bool value in config file for: anonymous_enable
- File operations in SAP Application server (AL11) using UNIX Command