spell

from: [url]http://stackoverflow.com/questions/5043662/multiline-handwriting[/url]
[url]http://activeden.net/item/handwriting-animation-tool-v25/11733[/url]

<fx:Script>
<![CDATA[
import mx.graphics.SolidColor;

import spark.components.Group;
import spark.components.RichText;
import spark.primitives.Rect;

private function createMultilineMask():void
{
var txt:RichText = new RichText();
txt.x = 20;
txt.width = 260;
txt.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tempus, eros ac dignissim interdum...";
txt.setStyle('fontFamily', 'Times');
txt.setStyle('fontStyle', 'italic');
txt.setStyle('fontSize', 16);
txt.setStyle('color', 0xFF0000);

var textMask:Group = new Group();

var ln1:Rect = new Rect();
ln1.x = 0;
ln1.y = 0;
ln1.width = 0;
ln1.height = 14;
ln1.fill = new SolidColor(0x000000);
textMask.addElement(ln1);

var ln2:Rect = new Rect();
ln2.x = 0;
ln2.y = 20;
ln2.width = 0;
ln2.height = 14;
ln2.fill = new SolidColor(0x000000);
textMask.addElement(ln2);

var ln3:Rect = new Rect();
ln3.x = 0;
ln3.y = 40;
ln3.width = 0;
ln3.height = 14;
ln3.fill = new SolidColor(0x000000);
textMask.addElement(ln3);

var container:Group = new Group();
container.x = 100;
container.y = 100;
container.mask = textMask;
container.maskType = 'clip';
container.addElement(txt);
addElement(container);

addEventListener(Event.ENTER_FRAME, drawLine);

function drawLine(event:Event):void
{
if (ln1.width < 300)
ln1.width += 2;
else if (ln2.width < 300)
ln2.width += 2;
else if (ln3.width < 300)
ln3.width += 2;
else
removeEventListener(Event.ENTER_FRAME, drawLine);
}
}
]]>
</fx:Script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值