Flex:[案例] Flash Builder 4中扩展TextLayout完美支持嵌入表情传输 转

http://bbs.airia.cn/thread-43301-1-1.htm

 

使用textLayout跟aswing实现图文混排遇到的问题。

在mx组件的时候就将一个sprite通过这样:canvas.rawChildren.addChild(sprite);就可以将图片文字一起显示,而我用aswing组件实现的时候是这样写的:var sprite= new Sprite();var panel = new JPanel();panel.addChild(sprite);//这里我不清楚是否应该这么写,所以不确定怎么样才能让它显示出来。请教各位大侠textFlow = TextFilter.importToFlow(textInput,TextFilter.TEXT_LAYOUT_FORMAT); containerController = new DisplayObjectContainerController(textContainer, topPane.getPreferredWidth(),topPane.getPreferredHeight());textFlow.flowComposer.addController(containerController);textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGED, picLoaded);textFlow.interactionManager = new EditManager(new UndoManager());textFlow.interactionManager.setSelection(0, 0);textFlow.flowComposer.updateAllContainers();

 

http://bbs.9ria.com/viewthread.php?tid=53558 l

 

找到一个官方对TextFlow动态创建的说明

http://docs.huihoo.com/flex/4/flashx/textLayout/conversion/TextConverter.html

结合例子:

http://blog.csdn.net/huanghr_1/archive/2011/02/27/6211639.aspx

新浪微博AIR的图文混排表情出来啦。只是使用

 

var markup:String = "

Hello, World

";var tFilter:TextConverter = new TextConverter();var textFlow:TextFlow = tFilter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT);var exporter:ITextImporter = tFilter.getExporter(TextConverter.TEXT_LAYOUT_FORMAT));var export1:String = exporter.export();var export2:String = exporter.export();

 

结合

 

补充一个demo

http://www.roseindia.net/tutorial/flex/flex4/components/richeditabletext.html

























This is a RichEditableText component of flex 4. It has feature of writing, editing text in multiple lines. It too have the hyperlinks, scrolling, selection properties.

At runtime of application you can edit and can format the paragraph also.

To visit: Roseindia.net hold CTRL key and then click.



































你可能感兴趣的:(Flex:[案例] Flash Builder 4中扩展TextLayout完美支持嵌入表情传输 转)