Skip navigation
Currently Being Moderated

How to draw a Stroke under each line

Feb 8, 2012 7:06 PM

How do I draw a line (Stroke) under each line?

 

Background

I'm trying to get the appearance of notebook paper. I'm using the Spark TextArea. I've tried a number of different approaches and all of them have drawbacks.

 
Replies
  • Currently Being Moderated
    Feb 8, 2012 11:58 PM   in reply to thx1138

    I guess you may dislike textDecoration format.

    7.3.7. textDecoration attribute

    <xs:attributename="textDecoration"type="xs:string"default="none."/>

    The text decoration to apply. Valid values include:

    none
    underline

     

     

    Without help of textDecoration, you may want to retrieve "y" values for all flash.text.engine.TextLine upon TextArea to draw those lines on your own.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 9, 2012 7:19 PM   in reply to thx1138

    The problem I'm having with this is to know when to draw the lines and if the TextLine is null then extrapolating out the correct coordinates, which I've done to some success.

    TLF draws background by flashx.textLayout.BackgroundManager. For TextArea, the specific function is BackgroundManager.drawAllRects(), which is the perfect place. Otherwise, bugs occur easily.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2012 6:01 PM   in reply to thx1138

    It's in textLayout.swc of Flex SDK. flashx.textLayout.BackgroundManager

    To modify the code there and make it work in your way, you need to replace that swc with your custom one. Or you just include source code of textLayout.swc in your project.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 15, 2012 6:38 PM   in reply to thx1138

    When background is set, drawAllRects() or onUpdateComplete() will definitely be called. The stroke is supposed to be drawn at that time, when TLF is drawing background.

    flashx.textLayout.BackgroundManager drawAllRects() is called only when 1) you set background and 2) the container is a kind of TCM. textarea should be a TCM.

    PS: The active participants on this sub-forum only focus on classes in textLayout.swc.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points