[as3]TextField文本显示的控制代码示例
[as3]TextField文本显示的控制代码示例
[as3]TextField文本显示的控制代码示例
- //htmlText方法:
- var tmp1_text:TextField=new TextField();
- tmp1_text.x=10;
- tmp1_text.y=10;
- tmp1_text.width=200;
- tmp1_text.height=60;
- tmp1_text.htmlText = "<font color='#0033FF'>蓝色</font><font color='#ff0000'>红色</font><font color='#FF6600'>橙色</font>" +"\n" +
- "<font color='#666666' size='11'>灰色</font><font color='#000000'>黑色</font><b><font color='#33CC00' size='18'>绿色</font></b>" +"\n";
- addChild(tmp1_text);
- //----------------------------------------------------------------------------------
- //TextFormat方法:
- var tmp2_text:TextField=new TextField();
- var format1:TextFormat=new TextFormat();
- var format2:TextFormat=new TextFormat();
- tmp2_text.x=10;
- tmp2_text.y=60;
- tmp2_text.width=300;
- tmp2_text.height=30;
- tmp2_text.text="Case Study: The E8 Particle Simulator for Garrett...";
- format1.size=15;
- format2.size=25;
- format1.color=0xff0000;
- format2.color=0x00ff00;
- tmp2_text.setTextFormat(format1,3,7);
- tmp2_text.setTextFormat(format2,8,11);
- addChild(tmp2_text);
- //htmlText+css方法:
- var tmp3_text:TextField=new TextField();
- var style:StyleSheet = new StyleSheet();
- tmp3_text.x=10;
- tmp3_text.y=100;
- tmp3_text.width=300;
- tmp3_text.height=20;
- style.setStyle(".style1",{color:'#000000',fontWeight:'bold'});
- style.setStyle(".style2",{color:'#ff0000',fontSize:'15'});
- style.setStyle("a:link", { color: '#006600', textDecoration: 'underline',fontSize:'12' });
- style.setStyle("a:hover",{color:'#003399',fontSize:'12'});
- style.setStyle("a:visited",{color:'#990000',fontSize:'12'});
- style.setStyle("a:active ",{color:'#000000',fontSize:'12'});
- tmp3_text.styleSheet = style;
- tmp3_text.htmlText="<a href='#'>极酷播放器</a>sdfwewe<span class='style1'>
sdlfjsiodf fwekfw</span><span class='style2'>酷播cuplayer</span>";- addChild(tmp3_text);
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...