惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
V
Visual Studio Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
B
Blog
I
InfoQ
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs
H
Help Net Security
博客园 - Franky
宝玉的分享
宝玉的分享
博客园 - 司徒正美
C
Check Point Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家

博客园 - 昊子

工作流参考模型(Workflow Reference Model) DNN default document的异常错误 如何使用GoogleCode提供的SVN Source Control服务 Norton PartitionMagic 8.0 Resizing Boot Partition 智能提示和那些值得崇拜的人 推荐一个Flex & AIR皮肤站点 SessionDiskCache 0.1版发布 Flex Repeater 多层嵌套 从没走远 SubmitMask 1.0 发布 如何获取Footer中的子控件 DNN学习笔记 之一 配置 使用NHibernate时产生的一个错误 NHibernate官方文档 之 NHibernate指南-前言 C#反转单向链表 C#事件编程 静态构造函数和静态成员变量初始化的调用时间 NHibernate和SqlImage 结束无谓的讨论吧
Flex locale
昊子 · 2007-07-08 · via 博客园 - 昊子

ResourceBundle的使用

新建文件夾(Locale)保存Locale資源
建子文件夾(en_US, cht_HK)用於區分Locale
在eu_US, cht_HK中分別添加資源配置文件 (資源名稱.properties)

項目屬性中設置Source Path,Add Folder    "Locale/{locale}", 其中{locale}將被編譯參數 -locale 自動替換

需要用locale的as 或 mxml中增加引用對象
[ResourceBundle("資源名稱")]
private static var rb:ResourceBundle;

<<--code AlertTest.mxml >>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
 <mx:Script>
  <![CDATA[
  import mx.resources.ResourceBundle;
       import mx.controls.Alert;
       
       
  [ResourceBundle("AlertMessage")]
       private static var rb:ResourceBundle;
       
       private function alertMessage():void
       {
        Alert.show(rb.getString('AlertMessage'));
       }
  ]]>
 </mx:Script>
 <mx:Button label="@Resource(key='AlertButtonName', bundle='AlertMessage')" click="alertMessage()"/>
</mx:Application>

<< - code  locale/en_US/AlertMessage >>

AlertMessage=The alert message in English
AlertButtonName=click me

<< - code  locale/cht_HK/AlertMessage.properties 注意,中文應使用UTF-8編碼
file-properties-info-Text file encoding >>

AlertMessage=繁體中文提示信息
AlertButtonName=點我


然後在編譯時設置Locale   右點項目-屬性-Complier-Additional Complier Arguments "-locale cht_HK"