Using a custom flex-config.xml file in flex builder 3

Source: Internet
Author: User

The following example shows how you can use a custom configuration file in a flex builder flex project by specifying an additional compiler argument,-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" verticalalalign = "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: 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 into SS multiple font-face declarations. --> <! -- See flash-unicode-table.xml For more examples. --> <ages> <language-range> <Lang> englishrange </lang> <range> U + 0020-u + 007e </range> </language-range> </ages> </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 inAdditional 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.