二、技术介绍
3、textfield文本域对象
在介绍textfield对象之前,首先我们须明白,在flash中,有三种文本:
1) 静态文本(static text)
内容和样式都在创作是决定,在flash mx中,可以有竖直的静态文本,在flash属性检查器中设置(关于静态文本的详细阐述,请参见作者的另一篇文章“flash text”)。
2) 动态文本(dynamic text)
是textfield对象的一个实例,可以在flash属性检查器中为其设置唯一的实例名,然后就可以使用该实例名来使用相应的方法与属性以改变动态文本的内容与样式。
本文所介绍的使用xmlsocket以web方式对生产系统进行及时监控的应用案例中,就是使用动态文本以不同的颜色来显示服务端发送过来的不同信息:
function myonxml(doc) {
var e = doc.firstchild;
selection.setfocus("_root.txt");
selection.setselection(0,0);
if (e != null && e.nodename == "message") {
if(e.attributes.type == "error"){
mytextformat.color = "0xff0000";
txt.setnewtextformat(mytextformat);
txt.replacesel("error -- " + e.attributes.text + " -- "
+ e.attributes.time + newline);
}else if (e.attributes.type == "normal"){
mytextformat.color = "0x0000ff";
txt.setnewtextformat(mytextformat);
txt.replacesel("normal-- " + e.attributes.text + " -- "
+ e.attributes.time + newline);
}
}
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器