| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <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" |
| width="100%" height="100%"> |
| |
| <fx:Declarations> |
| <s:SortingCollator id="sortingCollator"/> |
| </fx:Declarations> |
| |
| <fx:Script> |
| <![CDATA[ |
| import mx.collections.ArrayCollection; |
| import mx.events.ListEvent; |
| |
| [Bindable] |
| private var localeList:ArrayCollection |
| = new ArrayCollection([ |
| { label:"English (en)", data:"en" }, |
| { label:"French (fr)", data:"fr" }, |
| { label:"German (de)", data:"de" }, |
| { label:"Latvian (lt)", data:"lt" }, |
| { label:"Sweedish (sv)", data:"sv" }, |
| { label:"Chinese (zh)", data:"zh" }]); |
| |
| private static const wordList:ArrayCollection |
| = new ArrayCollection([ |
| "B", "b", "a", "A" , |
| "y (lt)", "i (lt)", "k (lt)", |
| "n (sv)", "ö (sv)", "o (sv)", "z (sv)", |
| "vu (sv)", "wo (sv)", |
| "däd (de)", "daed (de)", |
| "öf (de)", "of (de)", |
| "côte (fr)", "coté (fr)", |
| "手 (zh)", "中 (zh)", "土 (zh)", "岀 (zh)" ]); |
| |
| protected function localeSelector_changeHandler( |
| event:ListEvent):void |
| { |
| setStyle("locale", ComboBox(event.target).selectedItem.data); |
| wordList.refresh(); |
| } |
| ]]> |
| </fx:Script> |
| |
| <mx:VBox> |
| <mx:HBox> |
| <s:Label text="Select Language"/> |
| <mx:ComboBox id="localeSelector" |
| change="localeSelector_changeHandler(event)" |
| dataProvider="{localeList}"/> |
| </mx:HBox> |
| <mx:DataGrid id="dataGrid" width="100%" |
| dataProvider="{wordList}" rowCount="{wordList.length}"> |
| <mx:columns> |
| <mx:DataGridColumn headerText="Click here to sort" |
| sortCompareFunction="{sortingCollator.compare}"/> |
| </mx:columns> |
| </mx:DataGrid> |
| </mx:VBox> |
| </s:Application> |