Components Flex


 
 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    creationComplete="initApp()"> 
     
         
    
 
     
    import flashx.textLayout.elements.*; 
    private var textFlow:TextFlow = new TextFlow(); 
    private var paragraph1:ParagraphElement = new ParagraphElement(); 
    private var paragraph2:ParagraphElement = new ParagraphElement(); 
    private var span1:SpanElement = new SpanElement(); 
    private var span2:SpanElement = new SpanElement(); 
    private function initApp():void { 
        span1.id = "span1"; 
        span2.id = "span2"; 
        paragraph1.id = "paragraph1"; 
        paragraph2.id = "paragraph2"; 
        span1.text = "This is paragraph one."; 
        span2.text = "This is paragraph two."; 
        paragraph1.addChild(span1); 
        paragraph2.addChild(span2); 
        textFlow.addChild(paragraph1); 
        textFlow.addChild(paragraph2); 
        myRET.textFlow = textFlow; 
    } 
    private function changeColors():void { 
        // Set color of paragraph one. 
        textFlow.getElementByID("paragraph1").setStyle("color", 0xFF0000); 
        // Set color of paragraph two. 
        textFlow.getElementByID("paragraph2").setStyle("color", 0xFF0000); 
    }