• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

How can we simulate the Indesign paragraph rules in Adobe Flex4?

Guest
Jan 05, 2011 Jan 05, 2011

Copy link to clipboard

Copied

Hi,

http://help.adobe.com/en_US/indesign/cs/using/WSa285fff53dea4f8617383751001ea8cb3f-6dc1a.html

The above link specifies how Paragraph Rules are added in InDesign.

I have a scenario where I would want the same thing to happen in Flex.

So is there any thing that can be done in Adobe Flex 4 in TLF 1.1 so that we can add these rules in the view generated using Flex.

I was initially thinking of using inline graphics but I it will not help my cause.

Please share if there is any way out

Thanks

Ashar

TOPICS
Text layout framework

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 06, 2011 Jan 06, 2011

Copy link to clipboard

Copied

Interesting problem! Here's a suggestion to try.

Make your own ContainerController class that derives from ContainerController and overrides the addTextLine protected method. Each time a line is added, check it to see if it is the first or last line of the paragraph (assuming you wanted rules above and below). If so, then create a new DisplayObject for the rule, and make the rule a child of the TextLine. Then call super.addTextLine, which will add the TextLine to the container. To determine whether the line is first or last, get the TextFlowLine from the TextLine's userData. The TextFlowLine has a location property which will tell you if the line is first, last, middle, or only. To get TLF to use your derived ContainerController class, pass in one of your ContainerController's when you call addController on the textFlow's flowComposer.

So, your code might look something like this:

textFlow.flowComposer.addController(new RuleContainerController(sprite, width, height));

class RuleContainerController extends ContainerController

{

     override protected function addTextLine(textLine:TextLine, index:int):void

     {

          var line:TextFlowLine = textLine.userData as TextFlowLine;

          if (line.location & TextFlowLine.LAST)

          {

               ruleAfter:DisplayObject = // set up the rule here

               textLine.addChild(ruleAfter);

          }

          super.addTextLine(textLine, index);

     }

This code will add a rule to every paragraph, which may not be what you want. But you could add a user property that you add to the paragraph, and then the addTextLine could use the TextFlowLine to get the paragraph and only attach the rule if property is set.

This is really just sketched out, I haven't compiled or debugged it or anything, but it seems like it might work for your problem. Let me know how it works!

- robin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 07, 2011 Jan 07, 2011

Copy link to clipboard

Copied

Hi,

I was actually wondering whether flex doesnt have some thing by itself for this.

I will try to get somewhere with your approach and will let you know if that solves it,thanks any ways .

Ashar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 07, 2011 Jan 07, 2011

Copy link to clipboard

Copied

I mostly work with TLF itself, so I'm not a Flex expert. The only Flex oriented solution I can think of is to separate the text into different components around where you want the rules, and then make the rules their own component. But that has its own downsides, especially if you either have a lot of text, or if you're trying to maintain it in a back end database.

You could try reposting this in the Flex forum and see if the folks there have any suggestions.

- robin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 27, 2011 Jan 27, 2011

Copy link to clipboard

Copied

LATEST

Well finally I was able to get the paragraphs working in the following way, please let me know if there could have been a better solution/approach we can derive from here as this doesn't look that optimised.

I have an arraycollection of objects ,each with pair of line and paragraph element, any text updates leads to redraw these lines according to the new x and y coordinates of the paragraphs starting textflow line or the ending textflowline (as the case may be with rule on top or bottom)

-Ashar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines