It's not perfect, but this is what I would use unless I needed more features:
<?xml version="1.0" encoding="utf-8"?> <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ private var _st: Boolean = false; public function set strikethrough(b: Boolean): void { this._st = b; } override protected function updateDisplayList(unscaledWidth: Number, unscaledHeight: Number): void { super.updateDisplayList(unscaledWidth, unscaledHeight); this.graphics.clear(); if (this._st) { this.graphics.lineStyle(1, this.getStyle("color")); this.graphics.moveTo(0, unscaledHeight); this.graphics.lineTo(unscaledWidth, 0); } } ]]> </mx:Script> </mx:Label> On 5/9/07, Doug Lowder <[EMAIL PROTECTED]> wrote:
So true. A very quick and dirty starting point: StrikeLabel.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="drawStrike()"> <mx:Script> <![CDATA[ import flash.display.Graphics; private function drawStrike() : void { var g: Graphics = graphics; g.clear(); g.lineStyle(0, 0, 1); g.moveTo(0, height / 2); g.lineTo(width, height / 2); } ]]> </mx:Script> </mx:Label> In the app, use <StrikeLabel text="Strikethrough text" /> along with xmlns="*" in the Application tag. Like I said, it's a starting point so you'll probably want to set the line color, alpha, width, height, etc. as appropriate. --- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > Yes. Even if, like me, you are not a Flash/graphics guy, do not be > afraid of the graphics class. It is amazingly simple to add lines to > controls and to otherwise extend them visually. I just created some > components that can conditionally be put in an "editable" state which > shows a border using the graphics class, and adds several buttons and a > drag handle header (a Canvas, if you can believe that!), all tacked onto > the control using addChild. Just amazing. > > > > I started using some code posted by Alex Harui here on flexcoders for a > component named "CloseResizeImage". I also posted some of my own > modifications to thaqt code on flexcomponents, under the subject, > "Extend Image, add button, resize handle". > > > > A graphics line through your display text sounds like the simplest > approach. > > > > Tracy > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Douglas Knudsen > Sent: Wednesday, May 09, 2007 1:07 PM > To: [email protected] > Subject: Re: [flexcoders] I need a display suggestion. > > > > I'm going to answer in a popular way around here, write a custom > component. Assuming its possible in Flash 9, It would not be too hard > to write say IanLabel.as that extends Label.as adding a publicly > accessible boolean flag strikethrough. Over ride one of the methods, > which is not so clear to me at the moment sorry got deadlines, adding a > check > if( strikethrough) { > ///use graphics api to draw a line > } > > There's not huge amount of literature on custom component yet, but the > Adobe one 'Creating and Extending Flex Components' is available and > free. I'm far from a master on this topic, but squeezing in what I can > between deadlines. HTH! > > > DK > > On 5/9/07, Ian Skinner [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] > wrote: > > You will soon learn not to listen to carefully to UI advice from me, but > how about an alpha'd "Cancelled" diagonally across the text? > > > > Well, using the word "Cancelled" may be a bit of a sell. But I presume > if I could get the word to be "alph'd" across the text, I could also do > that with a diagonal line graphic or other options. > > > > What I need is a basic suggestion on how to do this? How do I > conditionally add something on top | under | through a given event box > based on the status property of the event element in the array > collection. > > > > > > Confidentiality Notice: This message including any attachments is for > the sole use of the intended recipient(s) and may contain confidential > and privileged information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the intended recipient, > please contact the sender and delete any copies of this message. > > > > ---------- Forwarded message ---------- > From: "Alex Harui" [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] > > To: [email protected] <mailto:[email protected] >, > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] > > Date: Wed, 9 May 2007 09:35:17 -0700 > Subject: RE: [flexcoders] I need a display suggestion. > > You will soon learn not to listen to carefully to UI advice from me, but > how about an alpha'd "Cancelled" diagonally across the text? > > > > ________________________________ > > From: [email protected] [mailto:[email protected] > <http://yahoogroups.com> ] On Behalf Of Ian Skinner > Sent: Wednesday, May 09, 2007 9:28 AM > To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] ; > [email protected] > Subject: [flexcoders] I need a display suggestion. > > I have been working on a calendar of events flex application as most > anybody who monitors these flex lists probably has noticed. This is a > reworking of an existing [D]HTML/CFML application. Part of the current > display is that canceled events are displayed with a strike-through text > > decoration. > > I am trying to convey this same information in the flex version. I have > tried using a strike-through decoration, but my attempts to use htmlText > > functionality in flex did not produce any results. I then tried to use > the alpha property to fade the canceled events. After embedding a font > so that the alpha effect would take effect, the results where less then > desirable, it was just not clear enough. > > Any suggestions on a simple but effective way to display the canceled > events? It should be noted that the events are color coded to indicate > which of four areas to which they belong. This color coded information > needs to be maintained for canceled events and I am reluctant to try and > > create four "canceled" colors. This is a quite a colorful, busy, > information packed screen as it is. > > Is there an easy way I could apply an image/graphic/effect to create > some kind of diagonal lines mask/background of the box containing the > canceled drive information? > > > > > > > -- > Douglas Knudsen > http://www.cubicleman.com <http://www.cubicleman.com> > this is my signature, like it? >

