適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: 從伺服器擷取資料...
從伺服器擷取資料...
spark.globalization 

MatchingCollator  - AS3 Flex

套件spark.globalization
類別public class MatchingCollator
繼承MatchingCollator Inheritance CollatorBase Inheritance GlobalizationBase Inheritance AdvancedStyleClient Inheritance EventDispatcher Inheritance Object

語言版本: ActionScript 3.0
產品版本: Flex 4.5
執行階段版本: Flash Player 10.1, AIR 2.5

The MatchingCollator class provides locale-sensitve string comparison capabilities with inital settings suitable for general string matching such as finding a matching word in a block of text.

This class is a wrapper class around the flash.globalization.Collator. Therefore the locale-specific string comparison is provided by the flash.globalization.Collator. However, this MatchingCollator class can be used in MXML declartions, uses the locale style for the requested Locale ID name, and has methods and properties that are bindable. Additionally, LastOperationStatus is set, if there is an error or warning generated by the flash.globalization class.

The flash.globalization.Collator class uses the underlying operating system for the formatting functionality and to supply the locale specific data. On some operating systems, the flash.globalization classes are unsupported, this wrapper class provides a fallback functionality.

檢視範例

更多範例

相關 API 元素



公用屬性
 屬性定義自
 InheritedactualLocaleIDName : String
[覆寫] [唯讀] The name of the actual locale ID used by this class object.
CollatorBase
 InheritedclassName : String
[唯讀] The name of the component class.
AdvancedStyleClient
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
 Inheritedid : String
The identity of the component.
AdvancedStyleClient
 InheritedignoreCase : Boolean
When this property is set to true, identical strings and strings that differ only in the case of the letters are evaluated as equal.
CollatorBase
 InheritedignoreCharacterWidth : Boolean
When this property is true, full-width and half-width forms of some Chinese and Japanese characters are evaluated as equal.
CollatorBase
 InheritedignoreDiacritics : Boolean
When this property is set to true, strings that use the same base characters but different accents or other diacritic marks are evaluated as equal.
CollatorBase
 InheritedignoreKanaType : Boolean
When this property is set to true, strings that differ only by the type of kana character being used are treated as equal.
CollatorBase
 InheritedignoreSymbols : Boolean
When this property is set to is true, symbol characters such as spaces, currency symbols, math symbols, and other types of symbols are ignored when sorting or matching.
CollatorBase
 InheritedinheritingStyles : Object
An object containing the inheritable styles for this non-visual style client instance.
AdvancedStyleClient
 InheritedlastOperationStatus : String
[覆寫] [唯讀] The status of the most recent operation that this class object performed.
CollatorBase
 InheritedmoduleFactory : IFlexModuleFactory
A module factory is used as context for finding the style manager that controls the styles for this non-visual style client instance.
AdvancedStyleClient
 InheritednonInheritingStyles : Object
The beginning of this component's chain of non-inheriting styles.
AdvancedStyleClient
 InheritednumericComparison : Boolean
Controls how numeric values embedded in strings are handled during string comparison.
CollatorBase
 InheritedstyleDeclaration : CSSStyleDeclaration
The style declaration that holds the inline styles declared by this object.
AdvancedStyleClient
 InheritedstyleManager : IStyleManager2
[唯讀] Returns the StyleManager instance used by this component.
AdvancedStyleClient
 InheritedstyleName : Object
The source of this object's style values.
AdvancedStyleClient
 InheritedstyleParent : IAdvancedStyleClient
A component's parent is used to evaluate descendant selectors.
AdvancedStyleClient
公用方法
 方法定義自
  
Constructs a new MatchingCollator object to provide string comparisons according to the conventions of a specified locale.
MatchingCollator
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。
EventDispatcher
 Inherited
Deletes a style property from this component instance.
AdvancedStyleClient
 Inherited
compare(string1:String, string2:String):int
Compares two strings and returns an integer value indicating whether the first string is less than, equal to, or greater than the second string.
CollatorBase
 Inherited
會將事件傳送到事件流程。
EventDispatcher
 Inherited
equals(string1:String, string2:String):Boolean
Compares two strings and returns a Boolean value indicating whether the strings are equal.
CollatorBase
 Inherited
[靜態] Lists all of the locale ID names supported by this class.
CollatorBase
 Inherited
Returns an Array of CSSStyleDeclaration objects for the type selector that applies to this component, or null if none exist.
AdvancedStyleClient
 Inherited
getStyle(styleProp:String):*
[覆寫] Gets a style property that has been set anywhere in this component's style lookup chain.
GlobalizationBase
 Inherited
Returns true if currentCSSState is not null.
AdvancedStyleClient
 Inherited
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。
EventDispatcher
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
The initialized method is called when this class or a class that extends this class is used in an MXML declaration.
AdvancedStyleClient
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
 Inherited
Returns true if cssState matches currentCSSState.
AdvancedStyleClient
 Inherited
Determines whether this instance is the same as, or is a subclass of, the given type.
AdvancedStyleClient
 Inherited
Propagates style changes to the children of this style client instance.
AdvancedStyleClient
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
 Inherited
Sets up the internal style cache values so that the getStyle() method functions.
AdvancedStyleClient
 Inherited
Registers the EffectManager as one of the event listeners for each effect event.
AdvancedStyleClient
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
會從 EventDispatcher 物件移除偵聽程式。
EventDispatcher
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
setStyle(styleProp:String, newValue:*):void
Sets a style property on this component instance.
AdvancedStyleClient
 Inherited
Detects changes to style properties.
AdvancedStyleClient
 Inherited
Flex calls the stylesInitialized() method when the styles for a component are first initialized.
AdvancedStyleClient
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
會傳回指定之物件的基本值。
Object
 Inherited
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。
EventDispatcher
事件
 事件 摘要 定義自
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。EventDispatcher
 InheritedThe change event is generated whenever the locale style is changed or another property is set that would cause the format of a number to change or cause updates to the other values available through this class.GlobalizationBase
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。EventDispatcher
樣式

樣式可分為一般樣式及與特定主題關聯的樣式兩種。如果是一般樣式,可以與任何主題搭配使用。如果是與特定主題關聯的樣式,只有在您的應用程式使用特定主題時才能使用該樣式。

一般樣式
 樣式 說明 定義自
 Inherited類型: String CSS 繼承:
語言版本: ActionScript 3.0  產品版本: Flex 4.5  執行階段版本: Flash10.1, AIR 2.5

The locale identifier that specifies the language, region, script and optionally other related tags and keys.
GlobalizationBase
建構函式詳細資料

MatchingCollator

()建構函式
public function MatchingCollator()

語言版本: ActionScript 3.0
產品版本: Flex 4.5
執行階段版本: Flash Player 10.1, AIR 2.5

Constructs a new MatchingCollator object to provide string comparisons according to the conventions of a specified locale.

This class sets the initial values of the various collation for general string matching uses such as determining if two strings are equivalent or finding a matching word in a block of text. In this mode, differences in uppercase and lower case letters, accented characters, and so on are ignored when doing string comparisons.

The comparison provided by an instance of this class is equivalent to constructing an instance of the flash.globalization.Collator with the initialMode paramater set to CollatorMode.MATCHING. For more details and examples of this mode, please see the documentation for the flash.globalization.Collator class

The locale for this class is supplied by the locale style. The locale style can be set in several ways:

  • Inheriting the style from a UIComponent by calling the UIComponent's addStyleClient method.
  • By using the class in an MXML declaration and inheriting the locale from the document that contains the declaration.
          Example:
          <fx:Declarations>
                 <s:MatchingCollator id="mc" />
          </fx:Declarations>
          
  • By using an MXML declaration and specifying the locale value in the list of assignments.
          Example:
          <fx:Declarations>
              <s:MatchingCollator id="mc_France" locale="fr-FR" />
          </fx:Declarations>
          
  • Calling the setStyle method, e.g. mc.setStyle("locale", "fr-FR")

If the locale style is not set by one of the above techniques, the instance of this class will be added as a StyleClient to the topLevelApplication and will therefore inherit the locale style from the topLevelApplication object when the locale dependent property getter or locale dependent method is called.

相關 API 元素

MatchingCollatorExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<!-- Sample program for spark.globalization.MatchingCollator -->
<s:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Declarations>
        <s:MatchingCollator id="collator"/>
    </fx:Declarations>

    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.ListEvent;

            private static const localeList:ArrayCollection
                = new ArrayCollection([
                    { label:"English (en)", data:"en" },
                    { label:"Turkish (tr)", data:"tr" } ]);

            private static const wordList:ArrayCollection
                = new ArrayCollection([
                    "Windows", "windows", "WINDOWS",
                    "Wındows", "wındows", "WİNDOWS" ]);

            private function inputWord_changeHandler(event:Event):void
            {
                const word:String = inputWord.selectedItem as String;
                resultWordList.text = "";
                for (var i:int = 0; i < wordList.length; ++i)
                {
                    if (collator.equals(word, wordList[i]))
                        resultWordList.text += wordList[i] + " ";
                }
            }
        ]]>
    </fx:Script>

    <mx:Form>
        <mx:FormItem label="Select Language">
            <mx:ComboBox id="localeSelector"
                change="setStyle('locale', localeSelector.selectedItem.data);"
                dataProvider="{localeList}"/>
        </mx:FormItem>
        <mx:FormItem label="Ignore case">
            <s:CheckBox id="ignoreCase" selected="{collator.ignoreCase}"
                change="collator.ignoreCase = ignoreCase.selected"/>
        </mx:FormItem>
        <mx:FormItem label="Input word">
            <mx:ComboBox id="inputWord" dataProvider="{wordList}"/>
            <s:Button click="inputWord_changeHandler(event)" label="Find"/>
        </mx:FormItem>
        <mx:FormItem label="Result Matching Words">
            <mx:Text id="resultWordList"/>
        </mx:FormItem>
    </mx:Form>
</s:Application>




[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。