2010-01-07 60 views
0

我有一個Box容器,裏面有一個標籤元素。當使用Matrix轉換盒子時,標籤元素不再可見。我如何使元素可見?Flex容器變換矩陣問題

<mx:Script> 
    <![CDATA[ 

     private function onBoxClick(event:MouseEvent):void 
     { 
      var transformMatrix:Matrix = this.box.transform.matrix; 
      transformMatrix.c = Math.PI * 2 * -15/360;; 
      this.box.transform.matrix = transformMatrix; 
     } 

    ]]> 
</mx:Script> 

<mx:HBox id="box" 
    x="100" y="100" 
    width="100" height="100" 
    backgroundColor="0x000000" 
    click="onBoxClick(event)"> 

    <mx:Label id="textLabel" text="This is a test" color="#FFFFFF" visible="true"/> 
</mx:HBox> 

回答

2

我猜測Label組件中的TextField沒有嵌入字體。如果您打算使用。旋轉.alpha上的動態文本您必須嵌入字體

您可以輕鬆地用常規的文本字段測試:

var t:TextField = new TextField(); 
t.defaultTextFormat = new TextFormat('Verdana',12,0x000000); 
t.embedFonts = true; 
t.rotation = 10; 
t.text = 'rotated'; 

addChild(t); 

這是假設你有嵌入在這個例子中,Verdana字體。如果你註釋掉第三行,你會看到文字消失。