Skip to main content
Inspiring
February 1, 2011
Question

ListMarkerFormat indent bug?

  • February 1, 2011
  • 1 reply
  • 3100 views

Hello,

I'm having trouble working with lists, tabs and indents.

Below the testcode I'm using:

/**
* @7111211  Stefan van Dinther
*/

package {
import flash.display.Sprite;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.elements.ListElement;
import flashx.textLayout.elements.ListItemElement;
import flashx.textLayout.formats.ListMarkerFormat;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.formats.TabStopFormat;

public class ListTest3 extends Sprite
{
  public function ListTest3() {
   var textFlow:TextFlow = new TextFlow();
  
   var list:ListElement = new ListElement()
   list.listStyleType = "decimal";
   list.listStylePosition = "inside";
   list.paddingLeft = 0;
  
   var listMarkerFormat = new ListMarkerFormat();

   var tabStops = new Array();
   var tabstop = new TabStopFormat();
   tabstop.position = 70;
   var tabstop2 = new TabStopFormat();
   tabstop2.position = 180;
   tabStops.push(tabstop);
   tabStops.push(tabstop2);
   listMarkerFormat.tabStops = tabStops;
   listMarkerFormat.beforeContent = "- ";
   listMarkerFormat.afterContent = String.fromCharCode(0x9);

   var item:ListItemElement;
   item = new ListItemElement();
   item.listMarkerFormat = listMarkerFormat;
   var paragraphElement = new ParagraphElement();
   var spanElement = new SpanElement();
   spanElement.text = "Text starts here";
   paragraphElement.addChild(spanElement);
   item.addChild(paragraphElement);
   list.addChild(item);

   textFlow.addChild(list);

   var cs:Sprite = new Sprite();
   cs.x = 0;
   cs.y = 0;
  
   textFlow.flowComposer.addController(new ContainerController(cs, 400, 200));
   textFlow.flowComposer.updateAllControllers();
   addChild(cs);
  }
}
}

This topic has been closed for replies.

1 reply

Inspiring
February 1, 2011

The example above works correctly and outputs:

-1.          Text starts here

But when I add:

   listMarkerFormat.paragraphStartIndent = 30;

I get:

-1.     Text starts here

So the paragraphStartIndent seems to destroy my tabStop...

Inspiring
February 1, 2011

And then when I change the first tabStop to 20 it uses the second tabStop. So I get something like this:

-1.                                                                                Text starts here

It seems to me, that maybe the paragraphStartIndent doesn't show but is used to calculate tabs. So when the tab is 70, it uses 70 - paragraphStartIndent (in this case 70 - 30). When the first tabStop is 20, it is not used because the paragraphStartIndent is 30, and then the second tabStop is used (180 - paragraphStartIndent = 180 - 30 = 150).

Adobe Employee
February 1, 2011

Right.  The paragraphStartIndent should be pushing the -1. 30 pixels to the left.  Then the tab should be applied.  At that point the "Text starts here" should have its start edge from which any tabs in the content are applied.  It's a bug.

Thanks for the report,

Richard