Skip to main content
Participant
December 8, 2011
Question

Problem in adding and removing Bullets at runtime

  • December 8, 2011
  • 1 reply
  • 917 views

I need to add nested bullets and can able to remove the selected bullets at runtime. I need to add both bulleted and non bulleted text in the tlf at the same time.

I tried to remove like this-     

 

tlf.listStyleType = ListStyleType.NONE;

But it is not working as required. I want to remove only the bullets of the selected  line.

Can any one reply with some suggestions or code to achieve this.

This topic has been closed for replies.

1 reply

Participating Frequently
December 9, 2011

I guess what you wanted is to remove the ListItem or the List. You can choose to keep the child paragraph of the ListItem/List. Remove the ListItem/List and then add the child paragraph to the List/ListItem's parent.

The following codes scrap is for Add/Remove ListItem/List. Hopefully, it will be helpful

// define text strings for the contents of the text flow

                              var textA:String = "It was a dark and stormy night. ";

                              var textB:String = "The quick red fox jumped over the lazy brown dog. ";

                              var textC:String = "Mary had a little lamb. ";

                              // define TextFlow, ParagraphElement and SpanElement objects

                              var textFlow:TextFlow = new TextFlow();

                              var paragraph:ParagraphElement = new ParagraphElement();

                              var span1:SpanElement = new SpanElement();

                              var span2:SpanElement = new SpanElement();

                              var span3:SpanElement = new SpanElement();

                              span1.text = textA;

                              span2.text = textB;

                              span3.text = textC;

                              // add spans at specified positions

                              paragraph.addChildAt(0, span2);

                              paragraph.addChildAt(0, span1);

                              paragraph.addChildAt(1, span3);

                              textFlow.addChild(paragraph);

                              // assign composer, controller, and update to display text

                              textFlow.flowComposer.addController(new ContainerController(this,200,200));

                              textFlow.flowComposer.updateAllControllers();

 

 

                              //The following code scrap shows how to add the list marker for a paragraph

                              //In the real code, you just needed to find the paragraph and do the same thing

                              textFlow.removeChild(paragraph);

                              var list:ListElement = new ListElement();

                              list.listStyleType = ListStyleType.DECIMAL;

                              var item:ListItemElement = new ListItemElement();

 

                              item.addChild(paragraph);

                              list.addChild(item);

                              textFlow.addChild(list);

                              textFlow.flowComposer.updateAllControllers();

 

                              //The following code scrap shows how to convert a list to a normal paragraph

                              textFlow.removeChild(list);

                              textFlow.addChild(paragraph);

                              textFlow.flowComposer.updateAllControllers();