Skip to content
T-STUDIO[唐] edited this page Mar 26, 2014 · 15 revisions

Welcome to the TLFControlSprite wiki!

/************************************************************************
*html标签布局方法
*标签一定要设置宽高(width And Height Must set),不然会报错 *************************************************************************/

const htmlStr:String="<font size=25 color=0x360112><b>T-STUDIO[唐]</b></font>"+ "<p>官网:<a href='http//:www.tang-studio.com'>http//:www.tang-studio.com</a><br/>"+ "博客:<a href='http://blog.sina.com.cn/tangstudio2012'>http://blog.sina.com.cn/tangstudio2012</a></p>"+ "<img width='180' height='180' src='assets/images/logo.jpg'/>"+ "<p><br/>T-STUDIO[唐]互媒创意工作室是一家新锐的商业互动媒体设计及品牌形象推广机构,<br/>"+ "始终从市场的角度及客户的需求出发,<br/>"+ "为企业提供全方位、多领域的创意设计服务。<br/>"+ "帮助企业和产品从硝烟弥漫的商战中脱颖而出,成为业界翘楚。</p>"

`var TLF1:TLFControlSprite= TLFControlSprite.fromHTML(htmlStr,null,350);

addChild(TLF1);

TLF1.addEventListener(TLFFlowEvent.LINK_TOUCHED,linkTouched);

//TLF1.showBoundaries = true;`

/************************************************************************
*xml标签布局方法:onLinkTouched不支持
*************************************************************************/
//<--TextFlow的xml用法可以去adobe官方参考

const xmlStr:String='<TextFlow lineBreak="toFit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">' + '<p><span color="#000000" fontSize="30" fontWeight="bold">T-STUDIO[唐]</span><a href="http//:www.tang-studio.com">http//:www.tang-studio.com</a>' + '<img width="180" height="180" source="assets/images/logo.jpg"/></p></TextFlow>'

`var TLF2:TLFControlSprite = TLFControlSprite.fromTextLayout(xmlStr,null,350);

TLF2.y =400;

addChild(TLF2);`
/************************************************************************
load外部html文件布局方法
<--onComplete和onLinkTouched使用
************************************************************************/

`TLFControlSprite.loadFromHtmlTextLayout("assets/textLayout/htmlLayout.html",null,350).onComplete(function(tlf01:TLFControlSprite):void{
tlf01.x = 400;

			addChild(tlf01);  

		}).onLinkTouched(linkTouched);`  

Clone this wiki locally