How to define markers in Flash TLFTextField?

I am using Flash TLFTextField

in a flex project. We can add bullets in TLFTextField

with HTMLText(li)

, but how can I add bullets in TLFTextField

without using HTMLText?

I can make bullets in classic Flash TextField

using the bullet property TextFormat

.

+3


source to share


2 answers


This is not a solid solution, but it did solve my problem. I am sharing my code so that it can help anyone who comes across this issue.



// Imagine you have to apply bullet to the text index between beginIndex, endIndex
var index : int = beginIndex; 
var le : FlowLeafElement = this.textFlow.findLeaf( index + 1 );

var listEle : ListElement = new ListElement();
while( le && index < endIndex ) {

    if( le ){

        var p : ParagraphElement = le.getParagraph();

        if( p ) {

            index += p.getText().length + 1;

            if ( p.getText().length > 0 && ( !( p.parent is ListItemElement ) ) ) {

                var childIndex : int = this.textFlow.getChildIndex( p );
                this.textFlow.removeChild( p );

                listEle = new ListElement();
                var listItem : ListItemElement = new ListItemElement();
                listItem.addChild( p );
                listEle.addChild( listItem );

                if( childIndex >= 0 ){
                    this.textFlow.addChildAt( childIndex, listEle );
                } else {
                    this.textFlow.addChild( listEle );
                }
            }
        }
    }
    le = le.getNextLeaf();
}

      

0


source


try it

var pText:String =       "<list listStylePosition='inside' listStyleType='disc' afterFormat = '\t' paddingLeft = '30' tabStops='e100 s700'>" +  
                         "<li><p>Mango</p></li>" +  
                         "<li><p>Apple</p></li>" +  
                         "</list>";                       


                    var t:TLFTypographicCase;  
                    textLayoutFormat = new TextLayoutFormat();  
                    //textLayoutFormat.color = "#ffffff";  
                    textLayoutFormat.fontFamily = "Myriad Pro";  
                    textLayoutFormat.fontSize = 36;  

                    textLayoutFormat.paragraphSpaceBefore = 12;  



                    linkNormal = new TextLayoutFormat();  
                    linkNormal.color = 0x26e1fd;  
                    linkNormal.fontFamily = textLayoutFormat.fontFamily;  
                    linkNormal.fontSize = textLayoutFormat.fontSize;  


                    richTextArea.textFlow = TextFlowUtil.importFromString(pText);  
                    richTextArea.textFlow.format = textLayoutFormat;  
                    richTextArea.textFlow.linkNormalFormat = linkNormal;

      



Please check this link for more help .. https://forums.adobe.com/thread/787203?tstart=0

Hope it helps

+1


source







All Articles