2009-03-30 6 views

답변

0

당신의 정확한 요구 사항에 따라, 라벨을 서브 클래스가 updateDisplayList을 무시하고, 단지 텍스트 가운데에 선을 그릴 수 있습니다. 여기

3

나는 같은 필요와 다소 mediagreenhouse 솔루션을 단순화 결국 :

package 
{ 
    import flash.text.TextLineMetrics; 
    import mx.core.mx_internal; 
    import mx.controls.Label; 

use namespace mx_internal; 

public class StrikeLabel extends Label 
{ 

    public function StrikeLabel() 
    { 
     super(); 
    } 

    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
    { 
     super.updateDisplayList(unscaledWidth, unscaledHeight); 

     if(textField) 
     { 
      var metrics : TextLineMetrics = textField.getLineMetrics(0); 
      var y : int = (metrics.ascent * 0.66) + 2; 

      graphics.clear(); 
      graphics.lineStyle(1, getStyle("color"), 1); 
      graphics.moveTo(0, y); 
      graphics.lineTo(metrics.width, y); 
     } 
    } 
} 
} 
+0

텍스트가 다음에만 strikesthrough 1, 여러 줄 때까지이 좋은 작품 최고 선. – invertedSpear

+0

아래의 내용을 모두 복사하여 형식을 지정하고 포맷하면 내가하고있는 것을 볼 수 있습니다 :'copy below this' var nLines : uint = super.mx_internal :: getTextField(). numLines; var yPos : int = 0; (var i : int = 0; i invertedSpear

관련 문제