Tue, 23 May 2006. 找找吧
吧台 读吧 链接 留言 设计沙龙 BT Men
找找吧
 
Photoshop . Flash . Asp . Dreamweaver . Css . Html . JavaScript . Xml . Flash AS . WEB标准 . Illustrator . Sql . WEB配色 . Access . ASP.NET 2.0 . VBScript . Xslt . Rss . Swift3D . IIS . Wap . WEB2.0 . .Net . Flsh AS .
‹ 超越Flash 8:未来的Flash平台与你 平面设计 平面设计 修改注册表提取PSD文件缩略图查看功能 ›
正确使用TextField.htmlText的做法
water 整理于 :26 来自: luar's Flash 未知 作者: luar    Large Medium Small
TextField可以支持一些HTML Tag,例如:
程序代码:[ 复制代码到剪贴板 ]
info.htmlText = "<b>Bold</b>, <i>italic</i>, <u>underline</u>";

结果:
程序代码:[ 复制代码到剪贴板 ]
Bold, italic, underline

但是,当利用htmlText逐步加入字段,就会自动出现换行的问题,例如:
程序代码:[ 复制代码到剪贴板 ]
info.htmlText = "<b>Bold</b>";
info.htmlText += ", <i>italic</i>";
info.htmlText += ", <u>underline</u>";

结果:
程序代码:[ 复制代码到剪贴板 ]
Bold
, italic
, underline

只要trace看看:
程序代码:[ 复制代码到剪贴板 ]
trace(info.htmlText);

原来Flash Player自行加了<p>:
程序代码:[ 复制代码到剪贴板 ]
<TEXTFORMAT LEADING="3"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="14" COLOR="#000000"><B>Bold</B></FONT></P></TEXTFORMAT> <TEXTFORMAT LEADING="3"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="14" COLOR="#000000">, <I>italic</I></FONT></P></TEXTFORMAT> <TEXTFORMAT LEADING="3"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="14" COLOR="#000000">, <U>underline</U></FONT></P></TEXTFORMAT>

因此,正确利用htmlText逐步加入字段的做法,是应该先将字段放在一个Variable里,最后传到htmlText中:
程序代码:[ 复制代码到剪贴板 ]
var tmpTxt = "<b>Bold</b>";
tmpTxt += ", <i>italic</i>";
tmpTxt += ", <u>underline</u>";
info.htmlText = tmpTxt;
Tags (标签) 引用通告地址 (0)  
Tags: Flash | Flash AS
复制引用地址http://www.gogogo8.com/ver2/Blog/trackback.asp?tbID=143
复制引用地址http://www.gogogo8.com/ver2/Blog/trackback.asp?tbID=143&CP=GBK
暂时没有评论
发表评论 - 注意输入验证码![本站已启用NoFollow标签]
作者:
用户:  密码:   注册?  验证:  
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
表  情
 
33 active user(s) in 10 minites. 0 member(s). 33 guest(s). 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 回到页面顶部
Mainly Powered by L-Blog , Styled & Modified by water . © 2005 . Processed in 0.078125 second(s) , 10 queries .
Name : Water  QQ : 26998026  MSN : linweb  Web : http://www.gogogo8.com/ 
用户名:   

密   码:   
     IT新动态 (45) RSS 2.0
     平面设计 (170) RSS 2.0
     VS 2005 (5) RSS 2.0
     动画制作 (40) RSS 2.0
     网页制作 (83) RSS 2.0
     编程开发 (59) RSS 2.0
     帮助文档 (7) RSS 2.0
     品吧好站 (30) RSS 2.0
     乱七八糟 (42) RSS 2.0

   

   

     2005年, 12月份
     2005年, 11月份
     2005年, 10月份
     2005年, 9月份
     2005年, 5月份
     2005年, 4月份
     2005年, 3月份
     2005年, 2月份
     2005年, 1月份


 
BLOG编码找找吧
共同创作协议RSS 2.0
找找吧 | Http://www.gogogo8.com/--为广大WEB设计、制作、开发爱好者提供原创并搜集精品文章的小站:平面设计-动画制作-网页制作-编程开发 Archive

gogogo8.com v 4_3