2011年12月5日

TextLayoutFramework 簡單測試



TextLayoutFramework是Flex上一功能齊全的文字編輯器。
它比RichTextEditor的功能還要齊全,可以顯示使用者電腦上的字體,排版等。


// 宣告一個TextArea對象                   
var textarea:TextArea = new TextArea();
textarea.editable = false;
textarea.percentHeight = 100;
textarea.percentWidth = 100;
                      
// TextLayout Framework編輯出來的字串
var string:String = "<flow:TextFlow direction='ltr' blockProgression='tb' whiteSpaceCollapse='preserve' xmlns:flow='http://ns.adobe.com/textLayout/2008'><flow:p><flow:span fontSize='48' fontFamily='文泉驛微米黑'><flow:tab/>測試</flow:span></flow:p><flow:p><flow:span fontSize='48' fontFamily='文泉驛微米黑'></flow:span></flow:p><flow:p><flow:span fontSize='48' fontFamily='文泉驛微米黑'></flow:span></flow:p><flow:p textAlign='center'><flow:span fontSize='48' fontFamily='華康巧風體W1'></flow:span><flow:span fontSize='48' fontFamily='Mixed'></flow:span></flow:p><flow:p><flow:span fontSize='48' fontFamily='華康巧風體W1'></flow:span></flow:p><flow:p><flow:span fontSize='48' fontFamily='文泉驛微米黑'></flow:span></flow:p><flow:p><flow:span fontSize='48' fontFamily='文泉驛微米黑'></flow:span></flow:p></flow:TextFlow>";
                      
// 宣告一個TextFlow對象
var textflow:TextFlow = new TextFlow();
textflow = TextFlowUtil.importFromString(string, WhiteSpaceCollapse.PRESERVE);
                      
// TextFlow對象設定給TextArea
textarea.textFlow = textflow;




預覽圖片 :

沒有留言:

ShareThis