2011-08-05 46 views
1

我得到的文件夾圖標,從來沒有標籤。我試過很多數據源,總是一樣的東西。文件,ajax調用,文本,它總是失敗。Flex樹不會顯示標籤,只是圖標

在下面的代碼中,我甚至設置了自定義處理程序並觀察XML進來,我設置了一個靜態文本標籤。從不顯示任何東西這發生在沒有標籤功能和使用labelField的情況下。是的,我100%確定屬性匹配。再次嘗試使用衆多不同的數據源。

我不知道什麼會模糊文字,但不是圖標。但我也檢查了。

試過this simple one file example,它編譯得很好。

的完整代碼如下:

<?xml version="1.0" encoding="utf-8"?> 
<s:HGroup 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>  
    <fx:XML id="selectedData2" source="assets/xml/orgchartmodel.xml"/> 
</fx:Declarations> 

<fx:Script> 
    <![CDATA[ 

     private function tree_labelFunc(item:XML):String { 
      var label:String; 

      label = "flexisshit"; //breakpoint hits here but I never see this text 

      return label; 
     }   
    ]]> 
</fx:Script> 

<mx:Tree id="tree" dataProvider="{selectedData2}" labelFunction="tree_labelFunc" width="100%" height="100%" showRoot="false" textDecoration="underline" textSelectedColor="0xFFCCFF" depthColors="[#FFFFFF, #EEEEEE, #DDDDDD, #CCCCCC, #BBBBBB, #AAAAAA]" /> 
</s:HGroup> 

上述

<employee layout="default" name="Eric Joplin" email="[email protected]" phone="555-0100" fax="555-0101" businessUnit="Management" status="present" gender="male"> 
<employee name="Gary Roberts" layout="left_below" email="[email protected]" phone="555-0100" fax="555-0101" businessUnit="Logistics" status="present" gender="male"> 
<employee layout="default" name="Alexander Burns" email="[email protected]" phone="555-0102" fax="555-0103" businessUnit="Logistics" status="present" gender="male"/> 
<employee layout="default" name="John Conner" email="[email protected]" phone="555-0104" fax="555-0105" businessUnit="Logistics" status="present" gender="male"/> 
</employee> 
<employe .... 
+0

你embeding字體?因爲你需要嵌入兩次。一次用於spark組件,一次用於mx組件。 –

+0

不是我所知道的。我需要嗎?我過去使用過flex,似乎沒有回想起它需要樹。 – Maximegalon

回答

1

我測試了你的代碼(僅顯示部分)中使用的XML文件,它爲我工作,所以我猜你有一個css或者某個嵌入字體的代碼。嘗試直接在mx:Tree的fontFamily中設置爲宋體:

<mx:Tree id="tree" 
     fontFamily="Verdana" 
     width="100%" height="100%" 
     textDecoration="underline" 
     textSelectedColor="0xFFCCFF" 
     dataProvider="{xmlListColl}" 
     labelFunction="tree_labelFunc" 
     showRoot="false" 
     depthColors="[#FFFFFF, #EEEEEE, #DDDDDD, #CCCCCC, #BBBBBB, #AAAAAA]" 
     /> 
+0

謝謝!這段代碼來自我的直接控制之外,解決了這個問題。榮譽給你。 – Maximegalon

+0

是的,過去這種事也讓我瘋狂。 –