AS3:如何将文本字段转换为MovieClips组?

发布于 2024-12-16 02:34:44 字数 162 浏览 2 评论 0原文

我已经遇到过这个问题几次了:

我有一个动态创建的文本字段,我想将此文本字段转换为一个影片剪辑,其中包含文本的每个字母的子影片剪辑,以便我可以单独为字母设置动画(例如对待它们)作为粒子并使它们爆炸)。当然,转换后的影片剪辑看起来仍应与原始文本字段相同。

最快/最简单的方法是什么?

I encountered that problem already a few times:

I have a dynamically created textfield, and I would like to convert this textfield into a movieclip containing a childmovieclip for each letter of the text, so that i can animate the letters individually (for example treat them as particles and make them explode). Of course the converted movieclip should still look the same way as the original textfield.

What's the quickest/easiest way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

挽袖吟 2024-12-23 02:34:44

您可以自己完成,但意味着大量编码(基本上,您应该创建包含字母的单个影片剪辑(作为文本字段或位图),而不是填充文本字段,将它们存储在数组中,并在需要时稍后播放它们)。

或者

只需使用 TweenMax 和 SplitTextField :)

You could do it by yourself, but implies lot of coding (basically, instead of filling the textfield, you should create singles movieclips containing a letter, either as textfield or bitmap, storing them in an array, and playing them later when needed).

OR

Simply use TweenMax and SplitTextField :)

紫南 2024-12-23 02:34:44

只创建字符串中每个字符的影片剪辑会更容易

要获取字符串中每个字符的数组,请使用 split
var myString:String="StackOverflow";
var myArray:Array=myString.split(""); //['S', 't', 'a', 'c', 'k', 'O', 'v', 'e', 'r', 'f', 'l', 'o' , 'w'];

然后我想你知道方法

如果你有一个静态文本字段(其值不会改变),

你可以将它分开(右键单击>打破分开),这将为你提供包含以下内容的文本字段:个别字符

It would be easier to just create movieclips of each character in the string

To get an array of each character in the string, use split
var myString:String="StackOverflow";
var myArray:Array=myString.split(""); //['S', 't', 'a', 'c', 'k', 'O', 'v', 'e', 'r', 'f', 'l', 'o', 'w'];

And then I suppose you know the way

OR

If you have a static textfield (whose value doesn't change)

You could break it apart (Right Click>Break Apart), and that will give you textfields containing individual characters

飞烟轻若梦 2024-12-23 02:34:44

您可以使用名为“TextAnim”的开源库。

查看:- http://code.google.com/p/textanim/

You can use the opensource lib called "TextAnim".

Check out:- http://code.google.com/p/textanim/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文