tags:

views:

21

answers:

1
+1  Q: 

Flex: X-out Label?

I am trying to make a label that has an X over it. Like so I can say was this price with an X over the price. I want to make it a component because I am going to use it more than once. I want the X to be close to the same size as the text so that it is not a giant X over small text or a small X over large text.

Here is the code I tried which did nothing at all:

<?xml version="1.0" encoding="utf-8"?>
<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml"&gt;

    <mx:Script>
     <![CDATA[

      override public function set text(value:String):void
      {
       super.text = value;

       var g:Graphics = this.graphics;
       g.clear();
       g.lineStyle(3,0xFF0000);
       g.lineTo(this.width,this.height);
       g.moveTo(0,this.height);
       g.lineTo(this.width,0);
      }  

     ]]>
    </mx:Script>

</mx:Label>
+1  A: 

See this post. It provides a component which will do this for you.

It's not currently supported natively.

Zack