views:

145

answers:

2

How can I skew a Textfield in order to set a ascending space for each line. Following image should illustrate my intention: link to example

A: 

Using StyleSheet.

Jorge
Could you give an example, how to define an ascending offset ?
algro
+2  A: 

Got it: adobe

public class TextBlock_createTextLineExample extends Sprite {

    public function TextBlock_createTextLineExample():void {

        var str:String = "I am a TextElement, created from a String and assigned " +
        "to the content property of a TextBlock. The createTextLine() method " +
        "then created these lines, 300 pixels wide, for display." ;

        var fontDescription:FontDescription = new FontDescription("Arial");
        var format:ElementFormat = new ElementFormat(fontDescription);
        format.fontSize = 16;
        var textElement:TextElement = new TextElement(str, format); 
        var textBlock:TextBlock = new TextBlock();
        textBlock.content = textElement; 
        createLines(textBlock); 
    }

    private function createLines(textBlock:TextBlock):void 
    {            
        var lineWidth:Number = 300;
        var xPos:Number = 15.0;
        var yPos:Number = 20.0;

        var textLine:TextLine = textBlock.createTextLine (null, lineWidth);
        while (textLine)
        {
            //increase textLine every Line 10 px to get an offset 
            textLine.x += 10
            textLine.y = yPos;
            yPos += textLine.height + 2;
            addChild (textLine);
            textLine = textBlock.createTextLine (textLine, lineWidth);
        }
    }
}

}

algro