2012-01-30 67 views

回答

2

在Flex 3中,实际上遇到了类似的问题,对于作为我们样式一部分的禁用链接按钮执行了删除操作。刚刚签出的代码,并期待在文档的火花标签,发现我是从MX标签使用功能明确表示,它不会[火花标签从measureText()工作:

措施假定它使用由此UIComponent的样式确定的UITextFormat 显示在单行UITextField(或UIFTETextField)中的 中。由于它们不使用UITextField(或UIFTETextField),因此不适用于Spark 组件。在Spark组件 措施的文本,得到了 spark.components.Label的测量或spark.components.RichText

所以我重新理解了它:

<?xml version="1.0" encoding="utf-8"?> 
<s:Label xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark"> 
    <fx:Script> 
     <![CDATA[ 
      override protected function updateDisplayList(unscaledWidth : Number, unscaledHeight : Number) : void 
      { 
       super.updateDisplayList(unscaledWidth, unscaledHeight); 
       drawLines(); 
      } 

      private function drawLines() : void 
      { 
       var totalHeight : Number = 0; 
       for (var i : int = 0; i < mx_internal::textLines.length; i++) 
       { 

        totalHeight = mx_internal::textLines[i].y; 
        graphics.lineStyle(1, 0x000000); 
        graphics.moveTo(0, totalHeight); 
        graphics.lineTo(width, totalHeight); 
       } 
      } 
     ]]> 
    </fx:Script> 

    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 
</s:Label> 
相关问题