首页 技术 正文
技术 2022年11月15日
0 收藏 696 点赞 4,704 浏览 1616 个字
以A的3次方为例,我们输入以下代码:/**
* 部分代码参考Adobe文档:
* http://help.adobe.com/zh_CN/AS3LCR/Flash_10.0/flash/text/engine/package-detail.html
* by kingnare.com
*/package
{
import __AS3__.vec.Vector; import flash.display.Sprite;
import flash.text.engine.ContentElement;
import flash.text.engine.ElementFormat;
import flash.text.engine.FontDescription;
import flash.text.engine.FontWeight;
import flash.text.engine.GroupElement;
import flash.text.engine.TextBaseline;
import flash.text.engine.TextBlock;
import flash.text.engine.TextElement;
import flash.text.engine.TextLine; [SWF(width="800", height="600", backgroundColor="#FFFFFF", framerate="24")] public class TextEngineTest_TextBaseline extends Sprite
{
public function TextEngineTest_TextBaseline()
{
//字体属性
var fd1:FontDescription = new FontDescription("Arial");
//格式设置
var ef1:ElementFormat = new ElementFormat(fd1, 16); var fd2:FontDescription = new FontDescription("Arial");
var ef2:ElementFormat = new ElementFormat(fd2, 10);
//将基线上移8个像素
ef2.baselineShift = -8; //创建已设置格式的文本的字符串
var te1:TextElement = new TextElement("A",ef1);
var te2:TextElement = new TextElement("3",ef2); var groupVector:Vector.<ContentElement> = new Vector.<ContentElement>();
groupVector.push(te1, te2);
//组成ContentElement集合
var groupElement = new GroupElement(groupVector);
//创建文本块
var textBlock:TextBlock = new TextBlock();
textBlock.content = groupElement;
//显示文本
createTextLines(textBlock);
} //显示文本
private function createTextLines(textBlock:TextBlock):void
{
var yPos = 20;
var line_length:Number = 450;
var textLine:TextLine = textBlock.createTextLine(null,line_length);
while (textLine)
{
addChild(textLine);
textLine.x = 15;
yPos += textLine.height + 8;
textLine.y=yPos;
textLine=textBlock.createTextLine(textLine,line_length);
}
}
}
}
上一篇: ranch分析学习(四)
下一篇: 【test】
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,996
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,510
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,353
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,137
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,770
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,848