Flex中通过调用StyleManager类的静态属性selectors显示当前selectors列表的例子

By Minidxer | September 14, 2008

接下来的例子演示了Flex中如何通过调用StyleManager类的静态属性,selectors显示当前selectors列表。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white"
  6.         creationComplete="init();">
  7.  
  8.     <mx:Script>
  9.         <![CDATA[
  10.             import mx.styles.StyleManager;
  11.  
  12.             private function init():void {
  13.                 arr = StyleManager.selectors;
  14.                 arr.sort(Array.CASEINSENSITIVE);
  15.                 list.dataProvider = arr;
  16.             }
  17.         ]]>
  18.     </mx:Script>
  19.  
  20.     <mx:Style>
  21.         TitleWindow {
  22.             backgroundAlpha: 0.4;
  23.             backgroundColor: haloSilver;
  24.             borderAlpha: 0.4;
  25.             borderColor: haloSilver;
  26.             cornerRadius: 12;
  27.         }
  28.     </mx:Style>
  29.  
  30.     <mx:Array id="arr" />
  31.  
  32.     <mx:TitleWindow title="StyleManager.selectors:"
  33.             status="({arr.length} items)"
  34.             dropShadowEnabled="false"
  35.             roundedBottomCorners="true">
  36.         <mx:List id="list" width="300" />
  37.     </mx:TitleWindow>
  38.  
  39. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Flex | 1 Comment » | Tags: ,

Search Posts