Skip to main content
Known Participant
April 15, 2009
Question

Custom tags

  • April 15, 2009
  • 2 replies
  • 1229 views

Hi,

is it possible to create custom tags?

I need to create a list (both numbered and bullet). It also would be nice to create a tag for headings so that they can be numbered automatically.

If it is not possible is there another method to implement this?

Thanks in advance.

This topic has been closed for replies.

2 replies

Known Participant
April 16, 2009

Thank you.

Adobe Employee
April 16, 2009

You cannot create your own custom FlowElements, which you would need to make your own tags. You can mimic list behavior using bullet characters and tabs, and you can set them up as lists using formats you create, but I think that's what you would need to do.

To use custom formats or styles, you need to get the most recent TLF Gumbo drops, or the weekly TLF labs drop (the original TLF from November didn't have custom formats). You can use the SetUserStyleOperation to apply custom styles.

I hope this helps,

- robin

Known Participant
April 20, 2009

I tested some alternatives and now I am using a styleName to indicate that the paragraph is a list element. To imitate the list behavior of a normal text editor I now want to draw the bullet using the graphics object of the controller (a Sprite). Is there an elegant way to get the positions of the paragraphs?
At the moment I save all paragraphs with the styleName = “list” in an array and get the position by using the paragraphBBox method (see ParagraphBorder example).
Another problem is that I need an event that is triggered if the position of the bullet is changed. This can happen if the user changes the text or scrolls. If I use the scroll event the position is not right (I assume that the scroll event is triggered before recalculating all positions). At the moment I am using the enterFrame event, but that’s not the optimal solution.
Has anyone an idea for this two problems?

Adobe Employee
April 20, 2009

There is a compositionComplete event you could listen for, by adding an event listener to the TextFlow. This will tell you when the line positions change. Another possibility to consider is to make the bullets inline graphics, and put a tab after the inline to position the following text. Then TLF will handle the positioning for you.